September 30, 2026

The mac mini -- USB serial ports

I routinely use USB to serial devices when I work on embedded projects. On linux, I can use "tail -f" on the system log file and watch the chatter when I plug the device in. It will end up being /dev/ttyUSB0 or /dev/ttyACM0 or some such.

What do I do on the Mac? Right now I have an STM32H743 board connected using the debug usb connector and I know that presents itself as a serial port. I would like to use it.

Use the ioreg command

This was actually useful, but yields a lot of information.
ioreg -c IOSerialBSDClient | grep usb
In the middle of the info this spews out was:
    | |   | | |             "IOTTYBaseName" = "usbmodem"
    | |   | | |             "IOTTYDevice" = "usbmodem103"
    | |   | | |             "IOCalloutDevice" = "/dev/cu.usbmodem103"
    | |   | | |             "IODialinDevice" = "/dev/tty.usbmodem103"
As it turned out /dev/tty.usbmodem103 was what I was looking for.

Screen and Picocom

Screen is installed and I try using it. The trick is how to exit. I learn that Ctrl-A Ctrl-D gets me out, leaving me "detached" -- i.e. screen is still running as a background job or something. Running "ps" shows it. Using screen -r reattaches to it. This is amusing, but not what I want. To fully exit the following works, albeit with a warning you have to agree to.:
Ctrl-A Ctrl=\
I do this:
brew install picocom
This gives my old friend "picocom". Typing Ctrl-A Ctrl-X gets me out.

I found it!!

Like any proper unix system, MacOS shows all the serial devices in /dev. The trick is figuring out which of the several hundred is the one you want.
picocom -b 115200 cu.usbmodem103
Part of the trick was setting the baud rate. Both screen and picocom default to 9600 and this shows nothing at all with my device talking at 115200. Note: The name changes each time you plug in the board.
Use this to discover the current name:
tom@chispa:~ ls -l /dev/cu*
crw-rw-rw-  1 root  wheel  0x9000005 Oct  4 07:33 /dev/cu.Bluetooth-Incoming-Port
crw-rw-rw-  1 root  wheel  0x9000001 Oct  4 07:32 /dev/cu.debug-console
crw-rw-rw-  1 root  wheel  0x9000003 Oct  4 07:57 /dev/cu.usbmodem21403
No telling what cu.debug-console is. It is some kind of virtual serial port built into MacOS and definitely not what we are looking for.
Have any comments? Questions? Drop me a line!