Arduino on Ubuntu without IDE

This is a small post on how to set up your Arduino development environment without using the crappy Arduino IDE. The setup uses an Arduino Uno.

The current version of Ubuntu (at this time it is Ubuntu 11.04) offers the latest version of the Arduino library through the Universe repository. This means that installation is as simple as typing:

 sudo apt-get install arduino-core

Be aware that there are two packages in the Ubuntu repositories;

  • arduino – Arduino library and IDE (including some additional libraries).
  • arduino-core – Arduino library only (without any java dependencies).

Since the Arduino IDE is of no interest to us, the core package is perfect. The package installes files under:

  • /usr/share/arduino
  • /usr/share/doc/arduino-core

A main makefile is included under /usr/share/arduino/ It can be used to build an Arduino project by creating a small project specific makefile, refer to the main makefile and finally define a few required constants. Then type:


Here is a screenshot from the description section:

Also, a main.cpp file is included in the core package. Personally, I prefer to create my own in each project, so I delete it;

sudo rm /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp

Now, create a project directory with the following content:

A make file Makefile

ARDUINO_DIR            = /usr/share/arduino
TARGET                 = <your project name>
ARDUINO_LIBS           =
MCU                    = atmega328p
F_CPU                  = 16000000
ARDUINO_PORT           = <serial port, e.g. /dev/ttyACM0>

include /usr/share/arduino/

A main file main.cpp

#include <WProgram.h>

int ledPin =  13;    // LED connected to digital pin 13

void setup() {
    pinMode(ledPin, OUTPUT);

void loop() {
    digitalWrite(ledPin, HIGH);   // set the LED on
    delay(500);                   // wait for half a second
    digitalWrite(ledPin, LOW);    // set the LED off
    delay(500);                   // wait for half a second

int main(void) {
    for (;;) {

Now build your project by typing the following in the project directory:

make upload

Your project should now be built and uploaded to the Arduino. Have fun!


To find out what port the arduino is connected to, connect the Arduino Uno and type:


There should be some lines similar to:

[11755.790269] usb 6-2: USB disconnect, address 3
[11758.350294] usb 6-2: new full speed USB device using uhci_hcd and address 4
[11758.555635] cdc_acm 6-2:1.0: ttyACM3: USB ACM device

This tells us that the Arduino is connected to serial port ttyACM3, which has the path /dev/ttyACM3.

This Post Has 8 Comments

  1. CrazyDuino

    Excellent post! thank you

  2. Scott

    Thanks! Just a FYI update, the next release of Debian and Ubuntu will have the makefile components in a new package: arduino-mk.

    You should “apt-get install arduino-mk” in the future, and that package will pull in arduino-core.

    This was done because arduino-core and arduino-mk are two separate projects and mixing the files wasn’t the right thing to do.

  3. nish

    Hola, intente seguir los pasos para independizarme del IDE de arduino, pero aun no consigo hacer que ande el proyecto aqui publico, tengo el ubuntu 11.10


  4. Edgar

    Hi! I would rather not remove the main.cpp from the arduino-core installation, as this would break the consistency of package management. Besides, this file does no harm, as your own main() will take precedence over anything defined in a library anyway.

    If you are afraid of misspelling main() in your source, and then getting the library version instead, then just add


    in your local Makefile.


  5. Havard

    In Ubuntu 14.10, the recipe for getting started is the following:

    1. $ sudo apt-get install arduino-mk

    2. Get your development user into the ‘dialout’ group:
    $ sudo gedit /etc/group
    and append your username to the comma separated list of usernames on the dialout line:

    3. Log out, log in, to get the group to take effect

    4. make an empty directory you want to program in.

    5. create this makefile (for the uno):
    ~/empty_dir_for_an_arduino_project $ cat Makefile
    ARDMK_DIR = /usr/share/arduino
    BOARD_TAG = uno
    include $(ARDMK_DIR)/

    6. make this code file:
    $ cat

    int main(void) {
    const int led_pin = 12;
    pinMode(led_pin, OUTPUT);
    for (bool state = true; ; state = !state) {
    digitalWrite(led_pin, state ? HIGH : LOW);

    7: make && make upload

  6. Moni

    Hi friends,
    i am moni from delhi The current version of Ubuntu (at this time it is Ubuntu 11.04) offers the latest version of the Arduino library through the Universe repository. This means that installation is as simple as typing:

    Thank you,

Leave a Reply