Serial ports on Mac OS X

While doing some development in Java (using RXTX like the Arduino IDE does), I always had errors like this one:

Caused by: gnu.io.PortInUseException: Unknown Application
    at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
    at com.rapplogic.xbee.RxTxSerialComm.openSerialPort(RxTxSerialComm.java:97)
    at com.rapplogic.xbee.RxTxSerialComm.openSerialPort(RxTxSerialComm.java:61)
    at com.rapplogic.xbee.api.XBee.open(XBee.java:140)
    ... 2 more

I was puzzled because I could not find any other program using the serial port!

Turns out Google is your friend on this and the error message is very misleading.

The RXTX library requires access to the /var/lock directory, but it does not exists on a Mac!!!

So you only need to create it properly:

sudo mkdir /var/lock
sudo chmod go+rwx /var/lock

via JGrass Tech Tips

comments powered by Disqus