Raspberry Pi is a credit card size ARM-powered mini computer which is very popular among embedded system developer and hobbyist. A vanilla Raspberry Pi is not come built-in with an operating system. The operating system for Raspberry Pi can be installed on an SD-card which is loaded during bootup process. So, to make your Raspberry Pi useful, you need to install an operating system into an SD Card, plug it to the SD Card slot, and turn on the Pi.
Here’s what you are going to need to make your Raspberry Pi run for the first time:
- A Raspberry Pi
- A 4 GB or higher capacity SD Card
- A MacOS X (because this article is using a Macintosh computer running on OS X 10.8 Mountain Lion).
- A Raspberry Pi operating system image based on Debian Linux, Raspbian “Wheezy”. This OS image can be downloaded here. Choose the Raspbian “Wheezy” system image direct download zip file.
- A 5V micro USB power adapter which capable to draw minimum 0.7A currents. A Raspberry Pi requires this as it’s power source. A 5V 0.5A power adapter is not sufficient to power the Raspberry Pi.
Follow the following steps to set up an SD card with Raspbian Wheezy system image:
- Format your SD Card using Disk Utility with FAT32 file system.
- Once it formatted, eject it.
- Open Terminal, and execute
df -h
to view currently mounted disks and it’s free space. This step is essential after you had ejected the SD Card to make sure that you won’t miss the mount point of your SD card on the next step. This command should show you something like below:aryo@MacBookPro ~/Dev/Raspberry Pi$ df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk0s2 446Gi 130Gi 316Gi 30% 34209827 82793155 29% / devfs 183Ki 183Ki 0Bi 100% 635 0 100% /dev map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home aryo@MacBookPro ~/Dev/Raspberry Pi$
- Take note the command output.
- Insert the SD card into the internal card reader, and execute:
df -h
You should see a difference from previous output. That is the mount point of your SD Card.aryo@MacBookPro ~/Dev/Raspberry Pi$ df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk0s2 446Gi 130Gi 316Gi 30% 34210912 82792070 29% / devfs 185Ki 185Ki 0Bi 100% 639 0 100% /dev map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /home /dev/disk1s1 15Gi 2.1Mi 15Gi 1% 0 0 100% /Volumes/NO NAME aryo@MacBookPro ~/Dev/Raspberry Pi$
- In my case, the SD card device is /dev/disk1s1 mounted on /Volumes/NO NAME, the SD card device itself is /dev/disk1 and it’s data partition located in s1. Take a note of it.
- Unmount (NOT eject) the SD card, and keep the SD card in place.
aryo@MacBookPro ~/Dev/Raspberry Pi$ diskutil unmount /dev/disk1s1 Volume NO NAME on disk1s1 unmounted aryo@MacBookPro ~/Dev/Raspberry Pi$
- Be careful, the next step is very dangerous, make sure that you are not mistaken in setting the target SD card device path or you may destroy your computer partition. Take your SD card device path notes.
- Extract the downloaded zip file to the same folder. Then, you now have a Raspbian Wheezy .img file.
- Execute the following dd command:
aryo@MacBookPro ~/Dev/Raspberry Pi$ sudo dd if=2013-05-25-wheezy-raspbian.img of=/dev/disk1 bs=1m Password: 1850+0 records in 1850+0 records out 1939865600 bytes transferred in 1050.454374 secs (1846692 bytes/sec) aryo@MacBookPro ~/Dev/Raspberry Pi$
- Be very patient! This step will took some minutes to hours. It depends on your SD card writing speed. In my case, on a Class 10 SD card, it tooks around 17 minutes to flash the whole image file to the SD card. But yours may be quicker or longer.
- After finished flashing the image to your SD card, it will be automatically remounted by your computer. The SD card is ready for you to use on your new Raspberry Pi. Eject it from your Mac, and plug it to the Raspberry Pi SD card slot.
Plug the Raspberry Pi power adapter, USB keyboard, connect the HDMI display port to a HDMI capable display monitor or TV, and you are ready to go.
Congratulations! You have successfully flashed Raspbian Wheezy system image to an SD card and running a Raspbian Wheezy on a Raspberry Pi.