Is there an equivalent of lsusb for OS X
Asked Answered
B

9

150

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?

Boastful answered 12/6, 2013 at 5:18 Comment(1)
If you don't mind, how are you using information like "interfaces and endpoints, interface associations, composite devices"?Ssw
T
205

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
Taxation answered 6/9, 2013 at 19:29 Comment(6)
Nice script! Would you like to add it as homebrew formula? This would be convenient.Livvie
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.Boastful
May be limited, but it does exactly what I needed. Makes my development environment consistent with just a brew install Thank you!!Seismism
That's a nice script, but it really shouldn't be called "lsusb" considering what lsusb can actually do: askubuntu.com/a/604169/598643Selfanalysis
A neat one would be alias lsusb='system_profiler SPUSBDataType' if you don't care too much about getting the exact same result for lsusbAdriannaadrianne
Funny how the most obvious answer is often the least plausible one.Necrology
C
114

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

ioreg -p IOUSB -l -w 0
Canorous answered 21/4, 2015 at 16:38 Comment(3)
See my response to @blekenbleu about ioregBoastful
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).Naara
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/ioregHerald
B
54

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

brew install usbutils

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

Bombproof answered 29/7, 2018 at 10:29 Comment(9)
Finally, the real deal. I can confirm that this one works on OX 10.13.6.Lamelli
Thanks, this is a much better solution, unavailable at the time I developed the lsusb script.Taxation
Thanks, @jlhonora. The irony is that Homebrew guys decided to add your lsusb script to homebrew-core, instead of my usbutils.Bombproof
You can always send them a PR.Taxation
Source: github.com/mikhailai/homebrew-misc/blob/master/usbutils.rbSsw
linking fails, I had to manually link it: ln -s /usr/local/Cellar/usbutils/007/bin/lsusb ~/bin/lsusbGwenore
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 usbutilsDoloresdolorimetry
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).Pun
it doesn't work at all! This lsusb shows only a single device whereas all the other commands shows lots of devices. I've tried both brew install usbutils and brew install -s usbutils, same behavior. Besides tree doesn't work, it simply says lsusb -t is only supported on Linux. lsusb --version returns lsusb (usbutils) 015Pumphrey
M
18

In mac osx , you can use the following command:

system_profiler SPUSBDataType
Minuend answered 20/4, 2015 at 5:26 Comment(2)
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.Boastful
this is the only command that allowed me to find my 'disappeared' device, thanks; lsusb did not work, sorryIsabeau
G
7

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.

Gurl answered 16/5, 2016 at 21:52 Comment(3)
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.Boastful
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/53188Saltpeter
That seems to have been fixed by now.Naara
F
5

I'll through my hat into this having tried the answers here. The lsusb script is barely working and the macOS port of usbutils doesn't capture string descriptors or support --tree.

It lead me to create cyme, a modern cross-platform USB list tool using system_profiler -json under the hood. It also uses libusb for extra data/cross-platform and udev on Linux. It supports --lsusb compatible mode, which near matches lsusb's output for all args. It should scratch the macOS lsusb itch and more.

Ferrochromium answered 3/12, 2022 at 15:27 Comment(1)
This is really good. Depth of information and great display.Hackney
A
3

How about ioreg? The output's much more detailed than the profiler, but it's a bit dense.

Source: https://lists.macosforge.org/pipermail/macports-users/2008-July/011115.html

Alcantar answered 2/7, 2014 at 6:9 Comment(1)
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.Boastful
R
1

At least on 10.10.5, system_profiler SPUSBDataType output is NOT dynamically updated when a new USB device gets plugged in, while ioreg -p IOUSB -l -w 0 does.

Rhinehart answered 23/12, 2015 at 16:17 Comment(3)
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).Boastful
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.Boastful
I don't see how this is different from this answer?Naara
D
1

On Mac OS X, the Xcode developer suite includes the USB Proper.app application. This is found in /Developer/Applications/Utilities/. USB Prober will allow you to examine the device and interface descriptors.

Dietrich answered 2/3, 2018 at 4:38 Comment(2)
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.Ottoottoman
It is an extra developer tool to download: download.developer.apple.com/Developer_Tools/…Maplemaples

© 2022 - 2024 — McMap. All rights reserved.