Serial console on a Mac with screen and /dev/tty.usbserial

Plug in the USB serial adapter and run ls /dev/cu.* to find its port, for example /dev/cu.usbserial-1420. Then run screen /dev/cu.usbserial-1420 9600 with the speed of the device, often 9600 or 115200, and press Enter. To exit screen, press Ctrl-A, then K, then Y.

Updated . Run on macOS 27 with the screen 4.00.03 and cu that ship with it: ports listed with ls /dev/cu.*, screen opened detached on a built-in port with stty flags, listed and closed with screen -X quit, and cu run without sudo to show the lock error.

Find the serial port

A USB serial adapter shows up as two files in /dev. List them before and after you plug it in, and the new name is your port:

ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port
/dev/cu.debug-console
/dev/cu.usbserial-1420

Typical names are cu.usbserial-XXXX for FTDI and Prolific adapters and cu.usbmodemXXXX for boards that act as a USB modem, such as many microcontroller boards. The number changes with the USB port you use.

Each port also has a /dev/tty.* twin. Use the cu one. The tty device is for incoming calls and waits for a carrier signal that a console cable rarely sends, so the session can hang with no output.

If no new port appears, check that macOS sees the adapter at all:

ioreg -p IOUSB

If it is listed there but has no port, the chip needs a driver from its maker. If it is not listed, try another cable: some USB cables only carry power.

Connect with screen

screen ships with macOS and is the quickest serial terminal. Give it the port and the speed:

screen /dev/cu.usbserial-1420 9600

The screen goes blank. That is normal: a console prints nothing until you send something, so press Enter and the prompt appears. You can add line settings after the speed, in stty style, separated by commas:

screen /dev/cu.usbserial-1420 115200,cs8,-ixon,-ixoff

Here cs8 means 8 data bits, and -ixon,-ixoff turn software flow control off.

To exit screen, press Ctrl-A, then K, then Y. Ctrl-A then D only detaches: the session keeps running and holds the port. To find and close a detached session:

screen -ls
screen -r
screen -X -S 98339 quit

To keep a copy of everything the device prints, start screen with -L. It writes a file named screenlog.0 in the current folder.

Connect with cu

cu is the other built-in tool. On a Mac it needs sudo, because it writes a lock file in /var/spool/uucp. Without it, cu stops with Line in use even when the port is free. We hit exactly this in our test.

sudo cu -l /dev/cu.usbserial-1420 -s 9600

To leave cu, type ~. at the start of a line, that is Enter, then tilde, then dot. If you are connected to the Mac over SSH, ssh catches the same sequence first, so type ~~. instead. The SSH escape sequences guide explains why.

Speed, parity and flow control

Both ends must use the same settings, or you get garbage or nothing. The usual notation is speed plus 8N1: 8 data bits, no parity, 1 stop bit.

DeviceCommon setting
Switches, routers, firewalls9600 8N1, no flow control
Raspberry Pi, most Linux boards115200 8N1, no flow control
Microcontroller boardsWhatever the firmware sets, often 115200 or 9600
Old modems and some industrial gearMay use 7E1 (7 data bits, even parity) or RTS/CTS

Signs of a wrong setting: random symbols mean the speed is wrong; text with a few wrong characters points to parity or data bits; output that stops after a screenful points to flow control. To see what the port is set to right now:

stty -f /dev/cu.usbserial-1420

For a Raspberry Pi, the serial console must also be turned on in the system first. The Raspberry Pi SSH guide covers the network route once the console has done its job.

Common problems

  • Resource busy or Line in use. Another program holds the port, often a detached screen. Find it with lsof /dev/cu.usbserial-1420 and close it, or run screen -ls.
  • A blank screen. Press Enter. If still nothing, check the speed, then whether you need a null modem (crossed) cable or a rollover console cable for that device.
  • Lines that step down like a staircase, or no new line at all. The device expects CR and LF differently. Many consoles want only CR when you press Enter.
  • Arrow keys or full screen menus look wrong. Set TERM on the device to match, see unknown terminal type.

screen or a dedicated serial terminal

screen and cu are enough for a quick look. A dedicated serial terminal for Mac helps when you go back to the same devices often: it remembers the port and line settings per device, lists ports for you and survives a cable that comes out. Either way, once the device is on the network, switch to SSH for daily work.

Questions

Should I use /dev/tty.usbserial or /dev/cu.usbserial on a Mac?

Use /dev/cu. The tty device waits for a carrier signal that most console cables never send, so screen can sit there with no output. The cu device opens at once.

How do I exit screen on a serial port?

Press Ctrl-A, then K, and answer Y. Closing the Terminal window instead can leave screen running in the background and holding the port, which then reports Resource busy.

Why does my serial console show garbage characters?

The speed is wrong. Close the session and try the other common speeds, 9600 and 115200 first, then 19200, 38400 and 57600.

Does a Mac need a driver for a USB serial adapter?

Recent macOS versions include drivers for the common chips. If the adapter appears in ioreg -p IOUSB but no /dev/cu. port appears, install the driver from the chip maker.

Sources

More in SSH on each system

All guides