Is there an equivalent of lsusb for OS X

Learn is there an equivalent of lsusb for os x with practical examples, diagrams, and best practices. Covers macos, usb, darwin development techniques with visual explanations.

Unveiling USB Devices on macOS: The 'lsusb' Equivalent

A stylized illustration of a MacBook connected to multiple USB devices, with data flowing between them. The macOS Finder icon is subtly visible, representing system interaction. Clean, modern design with a focus on connectivity.

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:

  1. Go to Applications > Utilities > System Information.app.
  2. Hold down the Option key, click the Apple menu () in the top-left corner of your screen, and select System 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.

Screenshot of the macOS System Information application with the 'USB' section selected in the sidebar. The main pane shows a list of connected USB devices and hubs, with detailed information for a selected device displayed below. Highlighted areas show Vendor ID and Product ID.

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

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 the IOUSB 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.

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