10

I have RXTX installed on a Mac. Both a Java JAR program and the Arduino software see the Arduino as a USB modem if it is Both claim the port is "already in use" if we try to open the serial port. Both claim "Unknown User". I have the rxtxcomm.jar in the Java Extensions.

How do I get either of these to work?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mkstlwtz
  • 720
  • 2
  • 7
  • 19
  • One of the most common issues with arduino dev on mac. You said both softwares see it, but only one can use it at a time - so make sure that your serial monitor on the Arduino IDE is closed before running your Java code and vice-versa! – HirdayGupta May 26 '19 at 06:14

3 Answers3

26

The OS X has some kind of exclusion mechanism on the serials ports. The MacBook does not have any serial ports, but the USB ports emulate them. When the Arduino is hooked up, it appears in the port list as "/dev/tty.usbmodem..." where ... are some trailing digits.

When is said the port was busy, that's a standard I/O exception that meant that we could not get access. The current owner was undefined because there was no current owner. We just did not have the required access to the directory to take ownership.

Using the Apple Terminal, do the following:

 sudo mkdir /var/lock
 sudo chmod a+rw /var/lock

This creates the required directory and makes it accessible. The serial port will no longer be busy, unless of course something else is really using it!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mkstlwtz
  • 720
  • 2
  • 7
  • 19
1

processing.app.SerialException: Serial port '/dev/tty.usbmodem...' already in use. Try quitting any programs that may be using it.

This happens to me when my external USB HDD is also connected. when I disconnect it, Arduino's upload process works as it should.

andreskwan
  • 1,152
  • 1
  • 13
  • 13
  • Removing my USB stick (flashdrive) fixed my issue. Thank you for posting that as the `/var/lock`, at least alone, did not seem to fix the issue. – Myles Best Jan 07 '15 at 01:39
0

I found some information on the RXTX site under troubleshooting, Mac OS X. They have a shell script that you can run called fixperm.sh that changes the permissions of /var/lock/. There is more information about /var/lock on the FHS site.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JAMESSTONEco
  • 2,051
  • 15
  • 21