105

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?

Étienne
  • 4,131
  • 2
  • 27
  • 49
Ted Middleton
  • 5,722
  • 9
  • 43
  • 64
  • 1
    If you don't mind, how are you using information like "interfaces and endpoints, interface associations, composite devices"? – Ben Creasy Oct 07 '18 at 21:41

9 Answers9

149

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
jlhonora
  • 8,573
  • 9
  • 40
  • 67
  • 2
    Nice script! Would you like to add it as homebrew formula? This would be convenient. – moritz Oct 30 '13 at 16:07
  • 2
    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 May 17 '16 at 19:17
  • 3
    May be limited, but it does exactly what I needed. Makes my development environment consistent with just a `brew install` Thank you!! – snakeoil Nov 22 '16 at 23:22
  • 2
    That's a nice script, but it really shouldn't be called "lsusb" considering what `lsusb` can actually do: https://askubuntu.com/a/604169/598643 – Mr. Kennedy May 31 '17 at 14:07
  • 3
    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 – yerlilbilgin May 15 '19 at 07:38
  • 1
    Funny how the most obvious answer is often the least plausible one. – Melllvar Nov 01 '19 at 04:43
  • 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 ;-) – Rastikan Nov 14 '19 at 02:11
80

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

ioreg -p IOUSB -l -w 0
David Grayson
  • 71,301
  • 23
  • 136
  • 171
  • See my response to @blekenbleu about ioreg – Ted Middleton May 17 '16 at 19:18
  • 3
    Copy of comment by [Ted Middleton](https://stackoverflow.com/users/134692): 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 Aug 21 '17 at 11:00
  • 1
    The manpages seem to have been removed. Alternates (as of May 2019) are: https://www.unix.com/man-page/mojave/8/ioreg/ and http://www.manpagez.com/man/8/ioreg/ – rdadolf May 09 '19 at 17:48
28

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).

11

In mac osx , you can use the following command:

system_profiler SPUSBDataType
David Grayson
  • 71,301
  • 23
  • 136
  • 171
QJGui
  • 859
  • 8
  • 10
  • 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 May 17 '16 at 19:10
6

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.

thiago
  • 156
  • 2
  • 4
  • 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. – Ted Middleton May 17 '16 at 19:28
  • This should be the accepted answer. Howerver, right now this package is broken because of its dependency `usbids`, track it over https://trac.macports.org/ticket/53188 –  Jan 31 '17 at 12:43
  • That seems to have been fixed by now. – Maarten Bodewes Aug 21 '17 at 11:05
4

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

lhagan
  • 51
  • 3
  • 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 May 17 '16 at 19:13
3
system_profiler SPUSBDataType

it your need command on macos

xds2000
  • 1,119
  • 11
  • 16
0

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.

blekenbleu
  • 19
  • 2
  • 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 May 17 '16 at 19:08
  • 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 May 17 '16 at 19:11
  • I don't see how this is different from [this answer](https://stackoverflow.com/a/29778245/589259)? – Maarten Bodewes Aug 21 '17 at 11:04
0

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.

RayM
  • 1
  • 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. – Mike Crawford Jul 16 '18 at 13:00