Before you can use the Raspberry Pi you will need to set up an SD card and load it up with the Raspberry Pi Operating system. The operating System is required to run any programs on the device and the Raspberry PI uses and OS based on Linux.
To create your SD card you need to carry out several steps involving loading an SD card onto a personal computer and loading the card up with the Linux image file provided by the Official Raspberry PI Website (See the link below).
Now many of the how-to’s out there deal with creating this image on a Linux system or a Windows system so to help the increasing number of folk out there with an Apple Mac I have created this post as the procedure on the Mac differs from the Linux procedure. I have used this procedure to create a card on the Mac and have successfully tested it on a Raspberry Pi so it does work.
The SD card itself can be bought from any computer or camera shop or of course you can get one online. It needs to be at least 4GB size and to use with your mac I suggest you get a USB adaptor which will cost about a fiver from PC world.
First Step – Download the disk image.
Currently the Linux variant being recommended by the Raspberry PI foundation is based on Debian (a version of Linux) and you will need to download a copy of this from the raspberry.org website here:
Direct download debian6-19-04-2012.zip
Download this to your desktop and once downloaded double click on the zip file to unzip the image and open the folder. The file you will be needing is the .img file.
OK now you will need to open the Terminal application on your Mac. Terminal allows us to issue commands direct to the Mac OSX system using it’s native unix environment. It’s actually quite easy but the commands may seem a bit daunting so we’ll go through this step by step.
Firstly to open terminal open the finder and select the applications folder. Scroll down until you find a folder called utilities and within that folder you will find the Terminal Application. Double click to open the app. It might be a good idea to drag this app to the dock whilst you’re at it as you may need to use it again so you may as well make life easy.
Once the Terminal is running you will see a window open with – well not much at this stage – but you will get a prompt similar to this.
This is the shell prompt indicating that the terminal is ready for you to type in a command. The ~ symbol indicates you are at your home directory your prompt will be different to this. (Your prompt will probably contain the hostname of your computer I have shortened my prompt here for simplicity).
At this point you need to insert your SD card into the Mac so you will need to push the card into the USB adaptor and insert it into a USB slot on your Mac.
Once your mac has recognised the card you’re in business.
Go to the Terminal you opened and type the following followed by the enter key
This will list the devices you have available on your Mac. It looks pretty scary but is really quite simple.
What we have to identify is the ‘Name’ of the SD card. The screenshot above has been taken before the card is inserted and lists all the devices attached to the Mac. Now insert the card and run df -H again
Note the last entry in the list /dev/disk2s1 . This shows a size of 7.9Gi, well my SD card is 8 Gig so that looks about right. We need to make note of the’ /dev/disk2s1′ bit.
Now for the tricky bit. You are going to need to select the desktop and then select the folder in which your Debian download is stored. It’s actually really easy to do bu t if you haven’t used Terminal before it might seem a bit unwieldily.
First we need to move to the Desktop. We’re going to use the cd (change directory) command for this so click on the terminal window and type
Then type cd followed by the name of the folder which contains the debian image which you downloaded earlier. The name of this folder may change over time but if you downloaded and unzipped it on your desktop then you can move to the directory containing the image by typing the following command
now hit the Tab key.
When you hit the tab key, ‘Terminal’ will see that you want the folder beginning with the word debian (actually debian-19-04-2012 at the time of writing) so it will fill in the rest for you. Hit enter and you will be inside the debian folder with a prompt something like this.
If you have problems with this just type cd followed by the name of the directory containing the image e.g. cd debian6-19-04-2012
(If you get stuck or lost just type cd ~ and this will place you back in your home directory so you can try again)
Now you can carry out the actual disk loading process but as I mentioned earlier the way we do this on the Mac is a bit different from linux so at this point we have to type the following:
diskutil unmountDisk /dev/disk2
note the /dev/disk2 is specific to my Mac and I didn’t need to type ‘/dev/disk2s’ just ‘/dev/disk2′ . You will use the device you identified in the previous step as being the SD card. You should get a message telling you the unmount was successful.
OK Last bit now we just need to type in this slightly complex command and go make a cuppa (cos it’s going to take a while)
dd if=debian6-19-04-2012.img of=/dev/disk2
dd is the command
if = input file (your downloaded image)
of = output file (your SD card device)
A couple of things to note.
WARNING: dd is a dangerous command so use i with care or you could mess up your system but if you ensure the /dev/disk2 or whatever your SD device is called is typed correctly you will be fine. Do not type the name of your main disk make sure you type the name of the SD card disk as described above.
You only need to /dev/disk2 and not the complete ‘/dev/disk2s’. The ’2s’ bit is not required. If in doubt just experiment here and the Mac will give a warning if it doesn’t like what you have typed e.g. dd: debian6-19-04-2012.imgof=/dev/disk2s: No such file or directory
type the command and hit enter. If nothing happens then that’s good as the image is probably being copied to the SD card. Sneak round the back of your mac and see if your usb adaptor is flashing. flashing is good. OK go make that well earned cappuccino and come back in about 15 mins.
NB: if you get a message saying dd: <device name> Resource Busy then you have not unmounted the device correctly so go back and repeat that step.
Eventually after a good few minutes the terminal should report that the image was successfully copied with a nice message confirming the dd operation was successful.