Arduino IDE hangs on OS X

Good evening all:

I have been using Arduinos of various stripes on a passel of XP, win7, and primarily OS X computers over the past year, but last night had an odd turn of events take place.

I was uploading a sketch to an Fio with a (Nokia 3310) bitmap display attached, making adjustments to the sketch, and re-uploading, to try to wrap my mind around bitmap programming.

While I was editing, with the Fio connected and being powered by a Sparkfun FTDI board, the IDE hung. After several minutes of waiting I forced it to quit. Ever since then I have not been able to get the IDE to start.

I would like to solicit help from the board to get my IDE back up and running.

The computer is a Mac Mini 2008 2.0 C2D running OS X 10.5.8. The IDE is version 022. The program is in the Applications folder, the sketches, libraries, etc are in ~/Documents/Arduino. I have run just about every revision of the IDE that has come out in the past year on this computer without a hitch.

When I start the IDE it takes off nicely, but stops with no open windows and a menu bar with only the Arduino menu on it (no File, etc.). I can open the preferences panel, but the window does nothing when I click OK. I can close the window using the close button or Cancel. Nothing happens when I choose About Arduino from the menu.

I have tried the following steps to resolve the issue, each at least once:

  • Deleted the ~/Library/Arduino/preferences.txt file.
  • Deleted a .plist file with Arduino in the name that was in ~/Library/Preferences.
  • Deleted ~/Library/Preferences/com.apple.java.JavaPreferences.plist
  • Repaired Permissions: nothing related to the IDE or Java had any errors.
  • Verified the HD: no problems noted.
  • Cold booted the computer once or twice.
  • Trashed the IDE and installed a fresh copy to the Applications folder from the .dmg.
  • Moved the sketches I had open at the time to a thumb drive in case they were corrupted.
  • Moved a couple of libraries that showed modification dates as the day of the crash to a thumb drive in case they were corrupted.
  • Ran System Update, which installed a couple of security updates as well as Java For Mac OS X 10.5 Update 8.
  • Launched the IDE with system.log showing in the Console. No messages appear. Nothing in /Library/Logs/Java either. However, if I try to click OK in the preferences window the following text appears in the system.log:
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at processing.app.Preferences.applyFrame(Preferences.java:511)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at processing.app.Preferences$3.actionPerformed(Preferences.java:371)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at ch.randelshofer.quaqua.QuaquaButtonListener.mouseReleased(QuaquaButtonListener.java:81)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Component.processMouseEvent(Component.java:5617)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Component.processEvent(Component.java:5382)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Container.processEvent(Container.java:2010)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Component.dispatchEventImpl(Component.java:4083)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Container.dispatchEventImpl(Container.java:2068)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Component.dispatchEvent(Component.java:3918)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Container.dispatchEventImpl(Container.java:2054)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Window.dispatchEventImpl(Window.java:1801)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.Component.dispatchEvent(Component.java:3918)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:501)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue.access$000(EventQueue.java:80)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue$1.run(EventQueue.java:462)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue$1.run(EventQueue.java:461)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.security.AccessController.doPrivileged(Native Method)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:95)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue$2.run(EventQueue.java:476)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue$2.run(EventQueue.java:475)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.security.AccessController.doPrivileged(Native Method)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:84)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:473)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
Apr 22 00:07:35 Mini [0x0-0x47047].cc.arduino.Arduino[1008]: 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

I did plug the Fio into a different Mac I also use (27" iMac 2.93 C2D, OS X 10.6.7, Arduino IDE 022), and was able to connect to the Fio just fine using the same FTDI adapter and upload the same sketches from the Mini via thumb drive (copied entire ~/Documents/Arduino folder over) except one. The IDE on that Mac complained that one sketch was corrupted and would not open it. The sketch opened fine in TextWrangler though, and looked normal.

At this point I am at an impasse. I have googled my fingers off looking for a similar situation or any help. It does not mean enough to me to justify a reinstall of the OS, but at the same time this particular machine has been my primary development machine and I would like to keep it that way.

I would greatly appreciate any help the forum could offer. Thanks to all in advance.

Mike

A couple of ideas spring to mind ...

  • Totally remove (you said you moved) all your Arduino "personal" stuff off your disk (make a copy of course). Check whether the IDE works with none of your sketches/libraries etc. installed. That includes all libraries etc.

  • Reinstall the FTDI drivers for the Mac.

  • Make a "startup" disk on a USB drive - this is useful anyway if you ever have to repair your (main) startup disk. I forget exactly how I did this, but Google will help you here.

  • Boot from the startup disk (ie. the USB drive), install Arduino IDE when running from that, and see what happens. I'm not sure what it will prove if it works, but I think it must prove something.

  • You can boot the Mac into a diagnostic mode (I can't recall the key) but if you do it does a disk check, hardware check etc. Could be worth trying.

  • Try making a new user, and running the IDE from that new user. Could isolate some issues with your personal folders (eg. ~/Library)

You've done more troubleshooting than most.

  • Maybe try running an older version of the IDE to see if anything changes.

  • Drop to the terminal and look at all of the serial devices your Mac has (ls -l /dev/cu.* and l s-l /dev/tty.*). Then run lsof on each of the serial devices. See if any other software is holding a serial device open.

Thank you very much for the help. I should have gone down those roads but they did not occur to me at the time. It is very helpful to have a second set of eyes look at a problem after your own go blurry.

I did not get a chance to try all of the suggestions, but two worked.

First I created a new user on the computer, and enabled Fast User Switching. I switched to that user and the Arduino IDE started up with no problem.

I switched back to my primary account, copied my ~/Documents/Arduino file to another disk, then threw it in the Trash and emptied the trash.

I then fired up the Arduino IDE, which came back with the following message:

After that it opened to a blank sketchbook and I was able to connect to the Fio with no issues whatsoever.

I did not have to reinstall the FTDI drivers, but maybe I will anyway.

I suspect something in my documents folder is corrupted. It could be anything: my Libraries and Hardware folders have a ton of strange stuff in them.

I will start adding stuff back to my ~/Documents/Arduino folder a little at a time until the IDE hangs on start and I can determine who the culprit is.

Thanks again for all the help!

Thank you for the ideas.

I did check in the Terminal to make sure the Mac was seeing the FTDI board by running

ls -l /dev/tty.*

But I did not check to see if it was in use. Running lsof is a great idea and I will remember to do that the next time I run into a snag, especially a serial port one.

I thought about trying to run an earlier IDE but figured I would ask here for ideas first instead of muddying the waters. In hindsight it probably would have found my mangled Documents folder and behaved the same way.

Thanks again!

Mike

To close the loop on this thread and for future reference, here is a quick way lsof can be used to figure out what has control of the serial port.

The lsof utility is a Unix program for listing open files. It has an absolutely endless list of options and features, but if you enter it on a Unix/Linux machine (such as in Terminal on Mac OS X) with no options it will dump a long list of all the open files on the computer. And on a Unix machine devices, like everything else, count as files.

To use it to just see what is using the serial port, I used grep to narrow down the list of results to just those that involve a serial port:

Mini:~ mlc$ lsof | grep /dev/tty
JavaAppli  5452  mlc   19u     CHR     10,22    0t45600 121807620 /dev/tty.usbserial-A700eZ0q
bash      11162  mlc    0u     CHR      16,0   0t108412 164305668 /dev/ttys000

Hmmm. It gave me the answer I wanted in a format that does not make a lot of sense. Instead of listing the program using the serial port, it gave me its process ID number.

To figure out what that process is named, I list all running processes and filter the list searching for that PID:

Mini:~ mlc$ ps aux | grep 5452
mlc       5452   0.2  2.0  1443808  42012   ??  S     9:41AM   4:33.48 /Applications/Arduino.app/Contents/MacOS/JavaApplicationStub -psn_0_606356
mlc      11661   0.0  0.0   599824    476 s001  R+    7:26PM   0:00.00 grep 5452
Mini:~ mlc$

And lo and behold in this case it is the Arduino software.

Common sense might tell you from reading the documentation that you could enter

lsof -c Arduino

to see if it is using the port but on the Mac, at least, this does not work because the Arduino IDE runs as a Java application and not as a native one. The list of running processes therefore shows its name as JavaApplicationStub, as seen above.

I am sure there are much more efficient and sexy ways to use lsof, but that way works for me.