Setting up the Raspberry Pi for programming from Mac OS X
In this article I will explain how I set up my Raspberry Pi to be programmable from my macbook pro. I didn't want to use an external monitor & keyboard, nor did I want to connect my Pi to the router of my home network as this setup would not be very mobile. To achieve this, I made use of SSH and the mac's ability to share its internet with other computers. I will not use any GUI to do the programming, as I find that running a GUI on a small embedded computer like this is overkill. Instead I will do all the programming from the command line. A small example of how to do this is included here as well. This article was mainly written as a future reference for myself, but I hope it can be useful for others as well.
Step 1: Prepare the SD-card
First of all, you will need an SD-card with a bootable linux image. I recommend using the "Raspbian Wheezy" image, which is an optimized version of debian. It is downloadable from http://www.raspberrypi.org/downloads/. Instructions for putting the image on the card properly can be found on the eLinux website.

If this has succeeded, you can boot up your Raspberry Pi! For the initial boot we will need an external monitor & keyboard, so we can set everything up properly.
Step 2: Basic configurations
The easiest way to do the basic setup is by making use of the raspi-config tool, it should start up automatically on your first boot.

If it doesn't start automatically, you can also launch it with:
sudo raspi-configI would recommend starting off by setting configure_keyboard and change_timezone. As we won't use any GUI for our programming, it is a good idea to set up memory_split so that the ARM gets 240MB of RAM and the VideoCore only 16MB as this will speed up things a lot. If you have a large SD-card (> 4G) you might want to consider using expand_rootfs to enable all this space. The downside of this is that backups of your SD image will be significantly larger.
The most important thing we had to do here, was to enable SSH. The more recent versions of raspbian have this enabled by default though.
If you have used configure_keyboard, you should run:
sudo setupconto avoid a massive delay in the boot process.
Step 3: Find out the Raspberry Pi's IP adres
At this point, we need our Pi connected to the internet. If you have a router close to your working environment, plugging it in there would be fine. If you don't however, it is very easy to use the "internet sharing" option on a mac to provide internet to your Raspberry Pi. On your mac, go to: "System Preferences > Sharing".

As you can see, I chose to share my macbook's wifi through the ethernet port. If I plug in my Raspberry there, it will have internet.
Now go back to the Raspberry Pi's monitor & keyboard. To be able to connect to the Pi through SSH, we need to know the IP adres it is using. To find it out, we enter the following command:
ifconfigYou should see something like "inet addr: 192.168.2.2".
Step 4: Connect to the Raspberry Pi from your mac
Now we know everything we need to know and everything is set up properly, we can disconnect the monitor & keyboard from our Pi (forever). To connect establish the SSH connection, go to the mac terminal and type (you should of course change the IP with the one you found earlier):
ssh -lpi 192.168.2.2
If it is the first time you connect to this device, you will probably see something like "The authenticity of the host can't be ... blabla". You can answer "yes" to this.
You will be prompted for the password now. If you did not change this in step 2, and you are using the recommended raspbian image, the password is "raspberry". Enter this, and you are now logged in to the Pi! You should see something like this:

Step 5: Setup a basic programming environment
You don't need much to programming from the command line in linux, but you do need a good text editor. I use vim. If this is the first time you work with vim, I recommend taking 10 minutes time to check out a good tutorial. To install vim on your raspberry pi, simply type:
sudo apt-get install vim
Because I think syntax highlighting and line numbering are essential programming tools, I want to enable these by default. You can do this by editing (or creating) the .vimrc file in your user directory. We'll do this using vim:
vim ~/.vimrcThen add the following two lines:
syntax on set number
Now it's time to test our tools! If you write a very simple "Hello World!"-program with vim, it should look like this:

If you name the file "main.cpp", you can compile it with:
g++ main.cpp -o HelloWorldIf you then run it with:
./HelloWorldyou can sit back, and enjoy the most simple program in the world!
If you're interested in doing some more advanced programming of your Raspberry Pi, check out my article on Low Level Programming of the Raspberry Pi.