Is there an equivalent of lsusb for OS X
Categories:
Unveiling USB Devices on macOS: The 'lsusb' Equivalent
Explore various methods to list and inspect USB devices connected to your macOS system, providing alternatives to the Linux 'lsusb' command.
For Linux users, the lsusb
command is a familiar and indispensable tool for listing connected USB devices and their details. However, macOS (based on Darwin) does not natively include lsusb
. This article will guide you through the various ways to achieve similar functionality on your Mac, from built-in system tools to third-party utilities, helping you diagnose and understand your USB hardware.
Using System Information (GUI)
macOS provides a comprehensive utility called 'System Information' (formerly 'System Profiler') that offers a graphical interface to view detailed hardware information, including USB devices. This is often the quickest way to get an overview without using the command line.
1. Open System Information
You can access System Information in a few ways:
- Go to
Applications
>Utilities
>System Information.app
. - Hold down the
Option
key, click the Apple menu () in the top-left corner of your screen, and selectSystem Information...
.
2. Navigate to USB Section
In the System Information window, locate the 'Hardware' section in the sidebar on the left. Click on 'USB' to display a list of all connected USB devices and their respective hubs. You'll see details like Vendor ID, Product ID, Speed, and Current Available.
3. Inspect Device Details
Select any device from the list to view more granular information in the lower pane. This includes manufacturer, product name, serial number, power requirements, and more.
System Information showing USB device details
Command Line Alternatives: system_profiler
For those who prefer the command line or need to script device enumeration, macOS offers the system_profiler
command. This command can output the same information found in the System Information GUI, but in a text-based format.
system_profiler SPUSBDataType
List all USB devices using system_profiler
The output can be quite verbose. To filter for specific information, you can pipe the output to grep
or other text processing tools. For example, to find devices from a specific vendor:
system_profiler SPUSBDataType | grep -A 10 "Apple Inc."
Filter USB devices by vendor name
SPUSBDataType
argument is crucial for targeting USB information. Other data types can be listed using system_profiler -listDataTypes
.Advanced Command Line Tool: ioreg
The ioreg
command is a powerful, low-level tool for inspecting the I/O Registry, which is the core of macOS's hardware abstraction layer. It provides extremely detailed information about connected devices, including USB. While more complex, it offers the most granular control.
ioreg -p IOUSB -l -w 0
List USB devices and their properties using ioreg
Let's break down the ioreg
command:
-p IOUSB
: Specifies that we are interested in theIOUSB
plane of the I/O Registry.-l
: Lists properties for each object.-w 0
: Prevents line wrapping, making the output easier to parse, especially for long property values.
ioreg
can be very extensive and complex. It's best suited for advanced users or when system_profiler
doesn't provide enough detail. You'll often need to pipe its output to grep
or awk
to extract specific information.Installing lsusb
via Homebrew
For users who prefer the familiar lsusb
syntax, it's possible to install a version of it on macOS using Homebrew, the popular package manager for macOS. This provides a more direct equivalent to the Linux command.
1. Install Homebrew (if not already installed)
Open your Terminal and run the following command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Install lsusb
Once Homebrew is installed, you can install the lsusb
utility (which is part of the usbutils
package) by running:
brew install usbutils
3. Use lsusb
After installation, you can use lsusb
just like you would on Linux:
lsusb
lsusb -v
(for verbose output)
brew install usbutils
lsusb
Installing and using lsusb via Homebrew
lsusb
from Homebrew provides a familiar interface, it might not always offer the exact same level of detail or behave identically to its Linux counterpart due to underlying OS differences. For the most comprehensive macOS-native details, system_profiler
or ioreg
are often superior.