This is a short guide on how to setup Eclipse for Mac OS X Lion (10.7) for use with Arduino in a relatively short amount of time. Using this guide, Eclipse can be setup to program and download code onto Arduino microcontrollers in about 15 minutes by using the Arduino Eclipse Plugin.
Initial Steps
To begin, download the following:
- Eclipse IDE for C/C++ Developers
- Arduino IDE for Mac OS X (version 1.0 at time of writing)
Installing Eclipse on Mac OS X is quite simple: extract the Eclipse package to the /Applications/ folder or another convenient location. Then simply drag the Eclipse.app file to the dock from the /Applications/eclipse/ folder.
Next, install the Arduino IDE. Once again, this is just a matter of extracting the zip file somewhere and dragging the Arduino.app file to the Applications folder.
Installing the Arduino Eclipse Plugin
Note: If this part of the instructions seems to be outdated, head over here and follow the instructions. This is a modified version of those instructions specifically for Mac OS X and the plugin version 1.1.7.
Now that Eclipse is installed, start it and choose a workspace (the default will work fine). If this is the first time Eclipse has been opened, close the welcome screen. Then, navigate to Help -> Install New Software and add a new site: http://www.baeyens.it/eclipse/update site/. Check the latest arduino eclipse extensions under arduino and click next.
Finish going through the installation and restart eclipse when prompted at the end.
Configuration
The last part is merely a matter of configuration. Eclipse should now be loaded with the workspace visible. From the application menu, navigate to Eclipse -> Preferences (shortcut command + ,) and then Arduino -> Arduino in the Preferences pane.
In order for Eclipse to use proper compilers and libraries for Arduino, the location of the Arduino IDE must be set. Users familiar with Mac OS X may know that .app files are actually just containers for application files (right click on any app and choose Show Package Contents in Finder). The files needed by the plugin are located in the Arduino.app container. If the Arduino.app application was added to the /Applications/ folder simply copy and paste this path into Arduino IDE path:
/Applications/Arduino.app/Contents/Resources/Java
If the Arduion.app application was installed to another location, simply modify this path appropriately.
Note: Sometimes simply copying and pasting this path does not work, and the location must be browsed to instead. In the Finder file browsing window, browse to this path directly by pressing command + shift + g.
Next, in preferences move to AVRDude and copy this path into the AVRDude config file field. Once again, and from now on, modify the path if the Arduino.app was installed to another location.
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf
Now move to Paths and replace each path with the appropriate location listed below:
AVR-GCC, GNU make, and AVRDude
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin
AVR Header Files
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include
Also be sure to check off Disable search for system paths at startup so these paths are not reset next time Eclipse is opened.
Additional Recommended Configuration
In Preferences, navigate to General -> Workspace and check Save automatically before build.
Under C/C++ -> Indexer it may be necessary to check Index unused headers and Index source and header files opened in editor. Some installations also do not seem to automatically index the HardwareSerial library, and Eclipse will mark it as not able to be found. Therefore, under Files to index up-front append “HardwareSerial.h” onto the end without quotes.
The Eclipse environment is now ready to create a new Arduino project.
Creating An Arduino Project In Eclipse
To start a new project using the plugin, go to File -> New -> Project… in Eclipse and select New Arduino sketch from the Arduino folder. Click next and name the project, then click next again and choose the Arduino Board that will be programmed from the drop down menu. Then type in the port where the board is located (e.g. /dev/tty.usbmodemfa131). To find out what port the board is using, plug it into the computer and check using the Arduino IDE application or open terminal and type the following command to list external devices.
ls /dev/tty.*
If the board is not available, leave the port field blank or use a placeholder value to change later. Click finish and the new project will be created.
Importing A Library
Another great feature of the Arduino Eclipse plugin is the ability to import libraries quickly. To import a library to a project, right click on it in the project explorer and choose import. Under the Arduino folder, choose Import a arduino library in the current project and choose next. Next, browse to or type the location of the library to import (e.g. the Servo library is located at /Applications/Arduino.app/Contents/Resources/Java/libraries/Servo) and click finish.
To use the library, simply include it in the project header file (e.g. #include “Servo.h”). Note that code copied from the Arduino IDE using an imported library will need to be changed so that the include statements use double quotes (“”) instead of angle brackets (<>).
Indexer Problems
If, at this point, Eclipse is underlining a lot of code in red, save and build the project first. If it is still underlining code in red, then try going to Preferences, C/C++ Settings -> Indexer and uncheck Enable indexer, click Apply, recheck it, and click OK. This should re-run the indexer. It may also help to open header or cpp files that contain objects or functions that cannot be found when the indexer is re-run. This seems to be a bug in the Eclipse indexer for Mac.
For all other troubles, here is a link to a thread that was very useful.
Conclusion
After reading this short tutorial, you should be able to configure an Arduino programming environment in Eclipse for Mac OS X relatively quickly. A lot of credit is due to Jantje for making such a fantastic plugin! Please leave comments if you appreciate this tutorial or have suggestions.



Thanks for this document. I’ll have a look to modify the plugin so he provides the correct configuration.
Best regards
Jante
Thanks, that was very useful to me.
Do you know whether it is possible to monitor the serial port, like we do with the Arduino IDE?
I’m glad to hear it worked for you.
Unfortunately I don’t know of a way to monitor the serial port from within Eclipse. However, you can still use the Serial Monitor program in the Arduino IDE just fine. I personally use CoolTerm [http://www.macupdate.com/app/mac/31352/coolterm] for Mac because it’s very clean and simple to use. Just make sure you set the baud rate in your code and in CoolTerm to match.
Thanks for the hint again. I have just installed Coolterm.
Just one more question: I have got a few libraries with a ifdef checking Arduino’s version and I am using Arduino V1. However, when I build it from Eclipse it seems to not pick up this variable. Thus, I guess I have to specify that somehow. Would you know how?
That is the example.
#if defined(ARDUINO) && ARDUINO >= 100
#include “Arduino.h”
#else
#include “WProgram.h”
#endif
#include
Please, ignore the question below. It seems that the plugin was having a hangover. It is all working now. Thanks.
I have just realized that my problem is actually related to imported libraries. For some reason the libraries are not compiling because they can’t find Arduino.h. The files created by the Arduino plugin can find it, tough.
Any clues?
Make sure your libraries use double quotes instead of angular brackets.
#include “Arduino.h” instead of #include <Arduino.h>
Hi thanks for the tutorial,
I did everything mentioned above. My program compiles fine, with no errors/warning. However, when I try to upload it to my Arduino Uno i get the following Error “avrdude: ser_open(): can’t open device “411″: No such file or directory”
I’ve checked and the device is connected via port 411.
Any suggestions?
http://picpaste.com/pics/e2c8889e9f9f326118b2cb0f40729d4e.1329698291.png
Hmm, why are you using a port number 411? You need to use the path to the Arduino board. It should be something like /dev/tty.usbmodemfa131
no, it shoes port 411 for me. “/dev/tty.usbmodem411″
Okay, I figured out what I was doing wrong. I was entering “411″ for port instead of “/dev/tty.usbmodem411″!
simply great,
thx a lot
Great explanation!! I lost one day to try to configure my eclipse environment.
but I have a problem in uploading the sketch: “AVRDude Upload has encountered a problem” in Details I read: Could not initializate class gnu.io.CommPortIdentifier”. Please help me.
Ciao
Francesco
Hmm, I’m not sure what to do really, is but I know some other people were having this problem. They seemed to have worked it out by forcing an update to the plugin – see here: https://github.com/jantje/arduino-eclipse-plugin/issues/5