List USB devices on OSX command line
Can I List USB devices on OSX - similar to lsusb
on Linux.
I know I can access from System Information
.
Solution 1:
In addition to system_profiler SPUSBDataType
(suggested by @kjs), you can also use ioreg -p IOUSB
:
$ ioreg -p IOUSB
+-o Root <class IORegistryEntry, id 0x100000100, retain 10>
+-o EHCI Root Hub Simulation@1A,7 <class IOUSBRootHubDevice, id 0x100000227,$
| +-o HubDevice@fa100000 <class IOUSBHubDevice, id 0x10000027a, registered, $
| | +-o Apple Internal Keyboard / Trackpad@fa120000 <class IOUSBDevice, id 0$
| | +-o BRCM2070 Hub@fa110000 <class IOUSBHubDevice, id 0x1000002b4, registe$
| | +-o Bluetooth USB Host Controller@fa113000 <class IOUSBDevice, id 0x10$
| +-o FaceTime HD Camera (Built-in)@fa200000 <class IOUSBDevice, id 0x100000$
+-o EHCI Root Hub Simulation@1D,7 <class IOUSBRootHubDevice, id 0x100000228,$
+-o HubDevice@fd100000 <class IOUSBHubDevice, id 0x10000027b, registered, $
+-o IR Receiver@fd110000 <class IOUSBDevice, id 0x100000288, registered,$
By default it clips to the window's width (80 chars in the example above), so you may want to add -w0
to get a full-width display. Also, adding -l
will show details (probably more than you need) about each of the devices:
$ ioreg -p IOUSB -w0 -l
+-o Root <class IORegistryEntry, id 0x100000100, retain 10>
| {
| "IOKitBuildVersion" = "Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64"
| "OS Build Version" = "14B25"
| "OSKernelCPUSubtype" = 3
| "OSKernelCPUType" = 16777223
| "OSPrelinkKextCount" = 185
| "IOConsoleLocked" = No
| "IORegistryPlanes" = {"IOACPIPlane"="IOACPIPlane","IOPower"="IOPower","IODeviceTree"="IODeviceTree","IOService"="IOService","IOUSB"="IOUSB","IOFireWire"="IOFireWire"}
[...etc...]
[EDIT]: If you just want the device names, you can filter the basic list to trim the junk:
$ ioreg -p IOUSB -w0 | sed 's/[^o]*o //; s/@.*$//' | grep -v '^Root.*'
EHCI Root Hub Simulation
HubDevice
Apple Internal Keyboard / Trackpad
BRCM2070 Hub
Bluetooth USB Host Controller
FaceTime HD Camera (Built-in)
EHCI Root Hub Simulation
HubDevice
IR Receiver
Solution 2:
Run this command:
system_profiler SPUSBDataType