Is there an equivalent of lsusb for OS X

129,032

Solution 1

I got tired of forgetting the system_profiler SPUSBDataType syntax, so I made an lsusb alternative. You can find it here , or install it with homebrew:

brew install lsusb

Solution 2

I typically run this command to list USB devices on Mac OS X, along with details about them:

ioreg -p IOUSB -l -w 0

Solution 3

Homebrew users: you can get lsusb by installing usbutils formula from my tap:

brew install mikhailai/misc/usbutils

It installs the REAL lsusb based on Linux sources (version 007).

Solution 4

In mac osx , you can use the following command:

system_profiler SPUSBDataType

Solution 5

If you are a user of MacPorts, you may simply install usbutils

sudo port install usbutils

If you are not, this might be a good opportunity to install it, it has ports for several other useful linux tools.

Share:
129,032

Related videos on Youtube

Ted Middleton
Author by

Ted Middleton

Updated on July 08, 2022

Comments

  • Ted Middleton
    Ted Middleton almost 2 years

    This question seems to be all over google, but the answers all point to using System Profiler. That's nice, but with System Profiler all you get is something that looks like this:

                DasKeyboard:
    
                  Product ID: 0x1919
                  Vendor ID: 0x04d9  (Holtek Semiconductor, Inc.)
                  Version: 1.06
                  Speed: Up to 1.5 Mb/sec
                  Location ID: 0x1d114000 / 11
                  Current Available (mA): 500
                  Current Required (mA): 100
    
                USB2.0 Hub:
    
                  Product ID: 0x0608
                  Vendor ID: 0x05e3  (Genesys Logic, Inc.)
                  Version: 32.98
                  Speed: Up to 480 Mb/sec
                  Location ID: 0x1d113000 / 10
                  Current Available (mA): 500
                  Current Required (mA): 100
    
                    Microsoft Basic Optical Mouse v2.0 :
    
                      Product ID: 0x00cb
                      Vendor ID: 0x045e  (Microsoft Corporation)
                      Version: 1.99
                      Speed: Up to 1.5 Mb/sec
                      Manufacturer: Microsoft 
                      Location ID: 0x1d113200 / 12
                      Current Available (mA): 500
                      Current Required (mA): 100
    

    That's great if all you want are the contents of a bunch of device descriptors, but lsusb gives you so much more - information on interfaces and endpoints, interface associations, composite devices... where can you find this information in OS X? There must be a tool that does this?

    • Ben Creasy
      Ben Creasy over 5 years
      If you don't mind, how are you using information like "interfaces and endpoints, interface associations, composite devices"?
  • moritz
    moritz over 10 years
    Nice script! Would you like to add it as homebrew formula? This would be convenient.
  • Ted Middleton
    Ted Middleton about 8 years
    The problem is that ioreg and IORegistryExplorer show you the kernel objects that have been matched to devices, not details of the devices themselves. That means you won't see interfaces on configurations other than the currently active one, and you won't see any endpoint information at all (which is the most useful output from lsusb).
  • Ted Middleton
    Ted Middleton about 8 years
    system_profiler has the same problem as ioreg - it reflects the state of kernel objects that the kernel has matched to devices, not the devices themselves. I want something that will basically display the full layout of the device, as in what's in all the configuration descriptors of all configurations.
  • Ted Middleton
    Ted Middleton about 8 years
    What I'd like is a tool that would show the contents of all of a device's configurations descriptors. ioreg won't do this, lsusb does.
  • Ted Middleton
    Ted Middleton about 8 years
    See my response to @blekenbleu. lsusb has much more information than ioreg/IORegistryExplorer, or any other program like system_profiler that just walks the iokit registry.
  • Ted Middleton
    Ted Middleton about 8 years
    That's a nice utility, but it's still just a fraction of what lsusb on linux can get you. lsusb on linux can give you the full contents of the device's configuration descriptors. Without that, I'm afraid this tool is mostly just a pretty-printer.
  • Ted Middleton
    Ted Middleton about 8 years
    See my response to @blekenbleu about ioreg
  • Ted Middleton
    Ted Middleton about 8 years
    Ah - ok, in the port file I see, "depends_lib port:libusb", and the source does indeed seem to require libusb. That would do it, I guess. I don't really use macports, though - I'm on brew. And I'd hate to have to install macports just for this, especially when lsusb could be reimplemented with user-space iokit so easily.
  • snakeoil
    snakeoil over 7 years
    May be limited, but it does exactly what I needed. Makes my development environment consistent with just a brew install Thank you!!
  • Admin
    Admin over 7 years
    This should be the accepted answer. Howerver, right now this package is broken because of its dependency usbids, track it over trac.macports.org/ticket/53188
  • MmmHmm
    MmmHmm almost 7 years
    That's a nice script, but it really shouldn't be called "lsusb" considering what lsusb can actually do: askubuntu.com/a/604169/598643
  • Maarten Bodewes
    Maarten Bodewes over 6 years
    Copy of comment by Ted Middleton: The problem is that ioreg and IORegistryExplorer show you the kernel objects that have been matched to devices, not details of the devices themselves. That means you won't see interfaces on configurations other than the currently active one, and you won't see any endpoint information at all (which is the most useful output from lsusb).
  • Maarten Bodewes
    Maarten Bodewes over 6 years
    I don't see how this is different from this answer?
  • Maarten Bodewes
    Maarten Bodewes over 6 years
    That seems to have been fixed by now.
  • Mike Crawford
    Mike Crawford almost 6 years
    Xcode.app/Contents/Applications/Utilities doesn't exist in Xcode 8.3, and there's no USB Prober in Applications. I do know that USB Prober is still available but I haven't yet been able to find out where it is. It's inside a package with some other tools.
  • Guido
    Guido almost 6 years
    Finally, the real deal. I can confirm that this one works on OX 10.13.6.
  • jlhonora
    jlhonora almost 6 years
    Thanks, this is a much better solution, unavailable at the time I developed the lsusb script.
  • Mikhail Iakhiaev
    Mikhail Iakhiaev over 5 years
    Thanks, @jlhonora. The irony is that Homebrew guys decided to add your lsusb script to homebrew-core, instead of my usbutils.
  • jlhonora
    jlhonora over 5 years
    You can always send them a PR.
  • Ben Creasy
    Ben Creasy over 5 years
  • rdadolf
    rdadolf about 5 years
    The manpages seem to have been removed. Alternates (as of May 2019) are: unix.com/man-page/mojave/8/ioreg and manpagez.com/man/8/ioreg
  • yerlilbilgin
    yerlilbilgin about 5 years
    A neat one would be alias lsusb='system_profiler SPUSBDataType' if you don't care too much about getting the exact same result for lsusb
  • Melllvar
    Melllvar over 4 years
    Funny how the most obvious answer is often the least plausible one.
  • Rastikan
    Rastikan over 4 years
    Fuckin awesome! "I got tired of forgetting the system_profiler SPUSBDataType" so true ... was just waiting for someone else to be more tired than I ;-)
  • lenooh
    lenooh almost 4 years
    linking fails, I had to manually link it: ln -s /usr/local/Cellar/usbutils/007/bin/lsusb ~/bin/lsusb
  • januszb
    januszb almost 3 years
    With bintray having been sunset, the binary distribution is no longer available (download fails with a 403). Installling from source works however, use brew install -s usbutils
  • Arnie97
    Arnie97 about 2 years
    Now the binary distribution is available from the official homebrew/core repo. Simply use brew install usbutils and do not use mikhailai's tap (which is trying to download from the dead bintray).