I’ve found that most tutorials relating to Xcode and Arduino don’t work. For the most part it seems that the arduino IDE gets an upgrade and files get shuffled around breaking peoples xcode and arduino setup. This tutorial is a modified version of Robert Carlsen’s. I found I had to make several modifications to get it working for me.
Create a new project in Xcode and select ‘Other’ then ‘ArduinoOnXcode’. It will ask for a new location to save the file.
Main.cpp is where your arduino code lives. Currently the project has a blinking LED sketch.
I’ve added the “clean all” button to my toolbar by right clicking on the toolbar and selecting “customize toolbar”. This is the button you’ll use to upload your sketch to the arduino. Once you’ve written your code just make sure that upload is selected in the dropdown menu and press “clean all”.
Head over to Robert Carlsen’s page for a few more handy tips.




Thanks for the compiled tutorial!
Just another data point: This still works with Arduino 0021 (the latest pack)
Also, those who would want to use this with Uno and MEGA, please check out:
Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/boards.txt
This file contains all the values for the MCU, upload speed and the protocol.
Hi – I got this to work with Arduino 0022 and XCode 3.2 using a Diecimila 168.
I had to add $(ARDUINO)/WString.cpp to line 73 before $(ARDUINO)/Print.cpp
Thanks!
Thank you for the useful hints.
On my MacBook, with Xcode 3.2.5 on OS X 10.6.6, I have to change line 67 of Makefile from
PORT = /dev/tty.usbserial* # does not work
to
PORT = /dev/tty.usbmodem* # works
Best regards,
Hi!
I can’t manage compiling projects involving a library. After some research, it seems to be related to the link options.
Full report at http://arduino.cc/forum/index.php/topic,49956.0.html
Any idea?
Thank you and best regards,
yeah I had this same problem. I haven’t come up with a solution though.
This is great, but I haven’t got it working with xCode 4.2. Anyone have a template for the new xCode format ?
I used Xcode 3 to program my Arduino using a template with the AVR tool-chain and the right Makefile.
It worked fine. See http://bit.ly/s4uASG.
But with Xcode 4, everything has changed for the template and I’m lost.
Does any reader try and write a template for Arduino?
I manage to use Xcode 4 for Arduino and chipKIT platforms.
Two issues:
1• personal #include libraries are not compiled/linked
2• templates on Xcode 4 are not compatible with Xcode 3 ones.
So I may need some help but here’s abase to start with at http://bit.ly/uEyP4c