Serial Port Access in VirtualBox Machines running on Mac OS X

This tutorial explains how to enable serial port access in virtual machines running in a VirtualBox. environment on Mac OS X. The presented approach uses the serial ports available on the OS X system and will propagate them to the virtual machine.

1. Find the Serial Ports

First, you need to find the serial ports on your OS X machine. Open a terminal, and provide the following command:
ls /dev | grep Repleo

Terminal Find Serial Ports

The handles for the serial port we will use later on are:

  • /dev/cu.Repleo-CH341-00302414
  • /dev/cu.Repleo-PL2303-00002314

Note, that in this case two serial adapters are connected on the machine, and the tail of the handle is dependent on the port to which the adapter is connected. This tail may change if the USB to Serial cable is connected to a different port.

2. Configure VirtualBox

Start VirtualBox and before firing up a virtual machine, select the settings menu. Within the settings menu, select the ports tab. Please make sure the virtual machine is really turned off, and not in a saved state, otherwise you won’t be able to make changes to this configuration. Enable the serial port and select the mode: Host device and fill in the device path.

Enable Serial Port in VirtualBox

3. Start the Virtual Machine

Start the virtual machine, make sure that the virtual ports are not used by other applications. The virtual machine will now show you the serial ports. For example after a linux boot, run the following command: dmesg | grep serial

Serial Port in Linux Virtual Machine

In our case we configured both serial ports.

4. Access the Serial Ports

In Linux, open for example Minicom on the command line (minicom -c on) and configure the port.

MiniCom in VirtualBox

Enter the local device handle, and please make sure hardware handshake is turned off (except if you have connected all the RTS/CTS lines). Save and close the configuration window. You will now be able to send and receiver data via the serial port in your virtual machine running on an OS X host.

Sending Bytes in Minicom VirtualBox

 5. Notes on Propagating the USB device to the Virtual Machine

VirtualBox allows to propagate a USB device to the virtual machine. Within OS X this sometimes causes an error message that the device is busy. Currently, the only solution to this problem is to toy around with kextunload,  kextload and rebooting.

USB Attach VirtualBox Fails