What is the Mac OS X equivalent of the Linux command udevadm info /dev/ttyACM0?

I am attempting get the USB information about a TTY device (/dev/tty.whatever) in a script.

UPDATE: I'm looking for information about a TTY / serial port device (not a disk). This is the type of output I am looking for (critical fields are highlighted):

[rhwood@localhost ~]$ udevadm info /dev/ttyACM3
P: /devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2/2-2.2:1.0/tty/ttyACM3
N: ttyACM3
S: digitrax-pr3-3
E: DEVLINKS=/dev/digitrax-pr3-3
E: DEVNAME=/dev/ttyACM3
E: DEVPATH=/devices/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2/2-2.2:1.0/tty/ttyACM3
E: ID_BUS=usb
E: ID_FOR_SEAT=tty-pci-0000_02_00_0-usb-0_2_2_1_0
E: ID_PATH=pci-0000:02:00.0-usb-0:2.2:1.0
E: ID_PATH_TAG=pci-0000_02_00_0-usb-0_2_2_1_0
E: ID_SERIAL=Digitrax_Inc._VC0M_Port
E: ID_TYPE=generic
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:0a0000:
E: ID_VENDOR=Digitrax_Inc.
E: ID_VENDOR_ENC=Digitrax\x20Inc.
E: ID_VENDOR_FROM_DATABASE=Microchip Technology, Inc.
E: MAJOR=166
E: TAGS=:seat:systemd:uaccess:

I am really interested in matching the DEVNAME (/dev/ttyACM3) to the VENDOR and MODEL information.

  • To help make the desired output clearer to understand, what would the actual output of udevadm info -a -n /dev/ttyACM0x be? Can you please edit your question to add that? – JakeGould Feb 26 '15 at 19:38
  • 1
    @JakeGould Thanks for helping clarify the question. I've removed the -a -n parameters for the udevadm command to get a less verbose output. – Randall Feb 27 '15 at 12:09

Based on some searching and finding this question and answer thread on the Unix and Linux Stack Exchange site, it does not seem there is a one-to-one equivalent of udevadm in Mac OS X. There is also this question and answer thread on Stack Overflow that seems to address the issue programmatically with a Python-based recommendation, but again it’s still not a one-to-one equivalent.

The closest thing I can come accross is Apple’s own command line tool, diskutil. So using your example:

diskutil info /dev/ttyACM0

Would give you a list of disk and partition related data such as this. For this example I ran diskutil info /dev/disk0 on my Mac Mini and this is the output:

Device Identifier:        disk0
Device Node:              /dev/disk0
Part of Whole:            disk0
Device / Media Name:      APPLE HDD HTS545050A7E362 Media

Volume Name:              Not applicable (no file system)

Mounted:                  Not applicable (no file system)

File System:              None

Content (IOContent):      GUID_partition_scheme
OS Can Be Installed:      No
Media Type:               Generic
Protocol:                 SATA
SMART Status:             Verified

Total Size:               500.1 GB (500107862016 Bytes) (exactly 976773168 512-Byte-Units)
Volume Free Space:        Not applicable (no file system)
Device Block Size:        512 Bytes

Read-Only Media:          No
Read-Only Volume:         Not applicable (no file system)
Ejectable:                No

Whole:                    Yes
Internal:                 Yes
Solid State:              No
OS 9 Drivers:             No
Low Level Format:         Not supported
Device Location:          "Lower"

Now that is useful for actual block level devices like disks, but if for some reason you need data on USB items that are not disks, you could use the command line version of system_profiler and have it filter just on USB items with SPUSBDataType like this:

system_profiler SPUSBDataType

Depending on how many USB items you have connected to your Mac, that list can be fairly massive. But it is useful from a scripting/command line point-of-view.

  • 4
    Thank you. Unfortunately I am looking for information on a TTY device, not a disk, and system_profiler does not give me anyway to map from information it contains back the item in the /dev/ directory. – Randall Feb 27 '15 at 12:10

I think this is what you're looking for:

ioreg -lp IOUSB

Specimen feedback from plugging in an rj45 serial cable into my OSX 10.14.6 Mojave Macbook's USB-C port is reported below:

+-o FT232R USB UART@14300000  <class AppleUSBDevice, id 0x10000ee76, registered, matched, active, busy 0 (7 ms), retain 14>
      "sessionID" = 573143338571350
      "iManufacturer" = 1
      "bNumConfigurations" = 1
      "idProduct" = 24577
      "bcdDevice" = 1536
      "Bus Power Available" = 250
      "USB Address" = 1
      "bMaxPacketSize0" = 8
      "iProduct" = 2
      "iSerialNumber" = 3
      "bDeviceClass" = 0
      "Built-In" = No
      "locationID" = 338690048
      "bDeviceSubClass" = 0
      "bcdUSB" = 512
      "USB Product Name" = "FT232R USB UART"
      "PortNum" = 3
      "non-removable" = "no"
      "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
      "bDeviceProtocol" = 0
      "IOUserClientClass" = "IOUSBDeviceUserClientV2"
      "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
      "kUSBCurrentConfiguration" = 1
      "Device Speed" = 1
      "USB Vendor Name" = "FTDI"
      "idVendor" = 1027
      "IOGeneralInterest" = "IOCommand is not serializable"
      "USB Serial Number" = "A9I2IIK0"
      "IOClassNameOverride" = "IOUSBDevice"

I know this was posted over (4) year's ago, but noticed nobody answered it. Hey, better late than never! HTH-

  • Thanks for answering this. I have (finally!) gotten around to testing it with my own devices. This seems to work fine if the device has a serial number, but not if it doesn't. – Randall Oct 15 at 10:54
  • @Randall The -l switch in my specimen command tells ioreg to "show properties for all displayed objects" and the -p switch tells ioreg to "traverse the registry over the specified plane" which in this case is IOUSB. The fact that your device is not being displayed might be down to the fact the machine doesn't see it, rather than being from an empty value in the "USB Serial Number" string. Otherwise, if the system could see it, I believe it should appear in the output of ioreg -lp IOUSB. Maybe try a different USB port and a different Mac to exclude things apart from cable – F1Linux Oct 15 at 11:42
  • The device is being displayed. My problem arises from not being able to tie /dev/cu.foo to a device if a serial number is not present in the device’s firmware. If the serial device is present, it seems easy. – Randall Oct 15 at 11:49
  • @Randall Try the command without the -p IOUSB switch: I just remarked that if you omit that and just execute ioreg -l the output prints the device, but not the serial number for it. Obviously the output is more verbose as it's not being limited to a single plane, but I guess you could add a grep to screen-scrape the output – F1Linux Oct 15 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.