Go Down

Topic: Serial Port Already in Use - MacOSX leopard (Read 34346 times) previous topic - next topic


May 19, 2008, 04:56 am Last Edit: May 19, 2008, 04:58 am by mpberger Reason: 1
I cannot get my Arduino_011 software to upload sketches or otherwise access my Arduino Diecimila USB AVR board.  When attempting to upload a sketch I receive the following message:

"Serial port '/dev/tty.usbserial-A4001KX4' already in use. Try quiting any programs that may be using it."
"Couldn't determine program size: text    data    bss    dec    hex    filename
processing.app.SerialException: Serial port '/dev/tty.usbserial-A4001KX4' already in use. Try quiting any programs that may be using it.
   at processing.app.Serial.<init>(Serial.java:140)
   at processing.app.Serial.<init>(Serial.java:72)
   at processing.app.Uploader.flushSerialBuffer(Uploader.java:66)
   at processing.app.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:68)
   at processing.app.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:43)
   at processing.app.Sketch.upload(Sketch.java:1632)
   at processing.app.Sketch.exportApplet(Sketch.java:1701)
   at processing.app.Editor$41.run(Editor.java:2004)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
   at java.awt.EventDispatchThread.pumpOnEventForHierarchy(EventDispatchThread.java:269)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)"

I am using OS X 10.5.2 (leopard), on a first gen MacBook Pro 17".
I have tried using other Arduino boards with no luck.
I have installed the software (Arduino 11) on my girl friend's computer (also leopard) and communication is no problem.
So, the problem is on my computer and not with OS X 10.5.  
I am pretty sure the problem lays in some conflicting drivers: I had earlier installed AVRdude and some other software (can't remember which exactly) to get my school's AVR board to work with my computer (which I managed).  (This board: http://cm-wiki.stanford.edu/wiki/AVR#AVR_Microcontrollers)
These other drivers must be trying to grab my present Arduino and prevent the Arduino software from communicating with it.  I have tried installing the most recent AVRdude software (5.5) to maybe overwrite the old drivers and get all present in a cooperative mood, and uninstalling it too (using "make clean, make install, make uninstall" etc...), with no luck.  Does anyone know how I can get in to my computer's guts and get rid of this software conflict, without reinstalling my system?  or perhaps another solution that might work just as well?



Have you tried rebooting?  Having avrdude installed shouldn't interfere with Arduino; did you install anything else that might use serial ports?  Check the Activity Monitor to see what other programs are running.  You might trying uninstalling and reinstalling the FTDI drivers used by the Arduino board (I'm not sure how, though).


Also, do you have rxtx.jar or comm.jar or similar in your Java extensions folder?  It might interfere with the one that comes with Arduino.


I have rebooted many times. I am not sure if I have anything else that would be using the serial ports.  I am also not sure how to uninstall the FTDI Arduino drivers, though I have re-installed them quite a few times.  I spotlighted for rxtx and found one file that was a java library or something in my "Processing" folder so I have uninstalled that (I never used it).

I just found other versions of the java files in the Library/Java/Extensions/ folder and have moved them to a temp folder to see if their move affects things... If the move does not help things, I will not write back until I hear more from the forum, if the move fixes things, I will reply to the thread right away.

Here is what my activity monitor says is going on:
312       Activity Monitor      mpberger      4.7      5      14.14 MB      983.33 MB      Intel      
168       AirPort Base Station Agent      mpberger      0.0      3      3.74 MB      915.46 MB      Intel      
208       Alarm Clock      mpberger      0.0      1      7.50 MB      920.54 MB      Intel      
215       AppleSpell.service      mpberger      0.0      1      1.16 MB      596.02 MB      Intel      
222       Arduino      mpberger      0.1      14      37.51 MB      1.16 GB      Intel      
178       ATSServer      mpberger      0.0      2      6.19 MB      650.35 MB      Intel      
177       Dock      mpberger      0.0      3      18.34 MB      936.05 MB      Intel      
223       DVD Player      mpberger      14.4      12      39.61 MB      998.88 MB      Intel      
183       Finder      mpberger      0.6      12      28.79 MB      983.36 MB      Intel      
294       Firefox      mpberger      6.8      8      77.71 MB      1,013.96 MB      Intel      
164       Folder Actions Dispatcher      mpberger      0.0      1      3.23 MB      876.25 MB      Intel      
211       GrowlHelperApp      mpberger      0.0      2      6.62 MB      880.23 MB      Intel      
214       HotBox      mpberger      0.0      2      2.47 MB      870.90 MB      Intel      
159       launchd      mpberger      0.0      3      580.00 KB      585.78 MB      Intel      
165       Little Snitch Network Monitor      mpberger      0.2      3      4.88 MB      902.53 MB      Intel      
166       Little Snitch UIAgent      mpberger      0.0      2      4.38 MB      902.05 MB      Intel      
34       loginwindow      mpberger      0.0      4      8.45 MB      898.14 MB      Intel      
297       Mail      mpberger      0.2      13      38.97 MB      980.90 MB      Intel      
302       Mail Unread Menu      mpberger      0.0      4      11.62 MB      928.33 MB      Intel      
220       mdworker      mpberger      0.1      4      7.44 MB      613.57 MB      Intel      
167       MOTUFireWireCons      mpberger      0.0      1      1.18 MB      586.66 MB      Intel      
176       pboard      mpberger      0.0      1      620.00 KB      586.68 MB      Intel      
206       Quick Look Server      mpberger      0.0      7      24.17 MB      938.97 MB      Intel      
210       Soundflowerbed      mpberger      0.0      4      7.23 MB      923.07 MB      Intel      
172       Spotlight      mpberger      0.0      2      4.99 MB      883.56 MB      Intel      
212       Stickies      mpberger      0.0      1      7.61 MB      920.62 MB      Intel      
307       SyncServer      mpberger      0.0      2      7.27 MB      604.23 MB      Intel      
303       System Events      mpberger      0.0      1      4.91 MB      894.70 MB      Intel      
182       SystemUIServer      mpberger      0.2      6      9.75 MB      927.82 MB      Intel      
179       TabletDriver      mpberger      0.0      2      3.00 MB      850.47 MB      Intel      
173       UserEventAgent      mpberger      0.0      3      4.81 MB      854.95 MB      Intel      

Thanks for your quick reply :D


Moving the JAVA extensions HAS FIXED IT!

Thank you so much for your help!



To explain: the default compilation options for RXTX create a library that uses locks to help ensure that only one program tries to access the serial port at a time.  This requires you to setup the lock directory (this was the purpose macosx_setup.command script that used to come with Arduino and Processing).  If you don't set up the lock directory, you get an error like the one you saw.  Since this is kind of annoying (and doesn't really help), the version of RXTX that comes with Arduino is compiled to not use locks.  But if you have a default version of RXTX installed in your Java extensions folder, it will get used instead of the Arduino one.


I'm late in replying, but I did not see this solution elsewhere, and so I think it might be useful for posterity. :)

Despite the explanations above, I was still not able to connect with the arduino board on OSX, getting the Serial port in use error.  I did not have any extra rxtx.jar files anywhere else on my machine.  However, this post helped me:


I don't read spanish, but the solution is clear enough:  Check that you have a
/var/lock directory, and ensure it is chmod 777.  Simple as that, and now I'm staring at a blinking LED!  :)


Anyone has experience of solving this on Vista? I posted in another thread earlier and found that I've to disable the port, reboot, and enable the port again to solve the problem.  Once I disconnected the usb cable and reconnect it again, the same "port in use" message appeared again.

Kind of tedious if I need to make changes here and there in codes and have to do the above everytime I need to upload.

Appreciate any help.



i recenetly just got an arduino, and have been getting the same problem on mac.

dimator, where abouts would the lock folder need to go?

i dont really understand how to lock the file?

any help would be great! its so frustrating not being able to upload




I can confirm that for arduinio-0013 after I downloaded & installed an rxtx alternative library I needed to do the following in the terminal to get it to work:

Code: [Select]
$ sudo mkdir /var/lock
$ sudo chmod 777 /var/lock

I cannot comment on the security implications of doing so.


P.S. This still doesn't explain why the original library seems to work with 0012 but not 0013.


sorry to be a pain, but i still get this working...

tried all on here as best as i can, and it is still in use aparently...

follower, when i type those in terminal, says i need a password...?

any help would be great



follower, when i type those in terminal, says i need a password...?

Yes, it will ask you for your administrator password. You should only run the commands above with administrator rights if you trust me or independently verify what the commands do to your satisfaction.



I did the trick in the terminal (it did not ask for admin password though) and it still doesn't work. I'm trying to use my Duemilanove with a Blusmirf Gold Bluetooth modem. I can connect to the modem with Zterm and with Processing but under the Arduino IDE it just cannot connect. Any ideas?


Managed to get the thing work! Some point to consider:

-in Zterm, after setting the modem, go to Setting->Connection and set the baud rate to 9600.
-indeed, you can only add commands to goldsmirf for 60 seconds! use the  command+K for keyboard buffer
-enter $$$ and then SU,96 to set the baud rate of Goldsmirf, then --- to exit
-set the baud rate of the arduino board. this is what I forgot... I used the Standard Firmata and changed the baud rate from 57600 to 9600
-unplugg the usb from your board and use only the BT. That also helps.
-set the baud-rate in Processing, as well! Example:

void setup(){
 arduino = new Arduino(this, Arduino.list()[4], 9600); //BAUD-RATE!!!
 mySensor1=new Sensor(1,64,0,10,150,100,125,5,20);


Also, I set the Bluesmirf to Slave Mode (SM,0). Everything works fine, apart from Max MSP:D


I am having this issue as well about the port being in use. The fixes suggested haven't worked for me. I can't be certain, but this all started when I installed Processing to so some testing with a drawing program. I was able to upload the StandardFirmata but since then I have not been able to upload anything else to the Arduino. I don't know if these are connected, but it is the last thing I can remember.

Go Up