Saturday, April 26, 2008

RXTX and the funky PortInUseException on Macosx

I am using the RXTX serial libs for getting data out of my gps. They always worked nice, but the first time I tried them on Macosx they didn't work, throwing this ugly: Unknown Application

Since the thing worked from commandline:
>>> cat /dev/tty.touchGPS-SSP-1
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32... etc etc

I was pretty helpless. Then I found in some mailinglist archive the solution. To cite the guy that solved my problem: "As I've discovered the PortInUseException rarely has anything to do the port being in use. For reasons I don't understand RXTX is not using /var/spool/uucp for lock files. It's using /var/lock. A directory that didn't exist on my system. Once I created this directory I started getting different errors for the RXTX code. This directory requires read/write permissions for the user. I just used the blanket chmod 777."

Nothing to add, tried it and it worked.

UPDATE as of Saturday 4th of April 2009:

As a nice anonymous user comments, these are the steps to go:
  1. Open 'Terminal' from Applications->Utilities
  2. Enter the commands:
sudo mkdir /var/lock   (hit enter end type your password)
sudo chmod 777 /var/lock (hit enter again)

Post a Comment