Problem:
I have a USB-to-Serial adapter that I need to use on a Mac. How do I configure it, and how do I read/write to it?
I am already partially familiar with using serial ports on Linux and Windows.
Notes:
This post is written as a reminder and contains just enough information to reproduce these steps in the future. It is not thorough. A little Google may be required in order to clarify or expand on some points.
The following steps were verified to work with macOS 10.12.6, with a very specific USB-to-serial adaptor that happened to work fine with Apple's default drivers. Your mileage may vary with other configurations and devices.
Steps Overview:
- Before you start, if drivers do not already exist then install them.
- Plug USB-to-Serial adaptor into your Mac
- Find info in "About this Mac" - More below
- Setup null modem and speed using Network Preferences - More below
- Find the device's path to access the Linux/POSIX way - More below
Step: Find adapter info:
To find out some basic information about your USB-to-Serial adapter, use the following steps.
- Go to "About This Mac" and click "More Info..." or "System Report..." (depending on your OS version)
- Find your device in the system report under "USB", and make note of what is there. This will help you identify your device in other steps.
Step: Configure serial communication using Network Preferences
To configure your USB-to-Serial adapter speed, etc., for use with other apps on your Mac, use the following steps.
- Open "System Preferences" and open the "Network" preferences pane
- Select your USB-to-Serial adapter if it is in the list, or add it then select it
- Click "Advanced..."
- Configure as null modem with the desired baud rate. The example screenshot below shows the attached device configured to 9600 bps (as well as some other configuration)
Step: Access your usb-to-serial port the Linux/Posix way:
References:
- https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/ioreg.8.html
- https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/screen.1.html
- https://plugable.com/2011/07/12/installing-a-usb-serial-adapter-on-mac-os-x/ (a more comprehensive guide for a specific device sold by Plugable)