Is there an equivalent of lsusb for OS X
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.
Related videos on Youtube
Ted Middleton
Updated on July 08, 2022Comments
-
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 over 5 yearsIf you don't mind, how are you using information like "interfaces and endpoints, interface associations, composite devices"?
-
-
moritz over 10 yearsNice script! Would you like to add it as homebrew formula? This would be convenient.
-
Ted Middleton about 8 yearsThe 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 about 8 yearssystem_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 about 8 yearsWhat 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 about 8 yearsSee 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 about 8 yearsThat'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 about 8 yearsSee my response to @blekenbleu about ioreg
-
Ted Middleton about 8 yearsAh - 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 over 7 yearsMay be limited, but it does exactly what I needed. Makes my development environment consistent with just a
brew install
Thank you!! -
Admin over 7 yearsThis 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 almost 7 yearsThat'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 over 6 yearsCopy 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 over 6 yearsI don't see how this is different from this answer?
-
Maarten Bodewes over 6 yearsThat seems to have been fixed by now.
-
Mike Crawford almost 6 yearsXcode.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 almost 6 yearsFinally, the real deal. I can confirm that this one works on OX 10.13.6.
-
jlhonora almost 6 yearsThanks, this is a much better solution, unavailable at the time I developed the
lsusb
script. -
Mikhail Iakhiaev over 5 yearsThanks, @jlhonora. The irony is that Homebrew guys decided to add your
lsusb
script tohomebrew-core
, instead of myusbutils
. -
jlhonora over 5 yearsYou can always send them a PR.
-
Ben Creasy over 5 years
-
rdadolf about 5 yearsThe 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 about 5 yearsA 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 over 4 yearsFunny how the most obvious answer is often the least plausible one.
-
Rastikan over 4 yearsFuckin 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 almost 4 yearslinking fails, I had to manually link it:
ln -s /usr/local/Cellar/usbutils/007/bin/lsusb ~/bin/lsusb
-
januszb almost 3 yearsWith 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 about 2 yearsNow 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).