Writing a Raspbian Image to a Raspberry Pi from a Mac
Documenting my attempt to set up my raspberry pi as a CJDNS node. First things to happen was installing Rapsbian on the SDCard using raspberrypi.org.
Materials #
- a raspberry pi with power cord
- a 32 GB microSD card
- my macbook
- an ethernet cable
Steps #
[Download a copy of raspbian](downloads.raspberrypi.org/raspbian_latest), this is the OS of choice for the raspberry pi.
Unzip the file into your root directory.
After the download is complete, run:
df -h
and take note of the listed devices.
Connect the SD card reader with the SD card inside. Be sure the SD card is formatted as FAT32.
Run
df -h
again and look for the newly added device. Record the device name of the SD card’s partition, for example, mine was /dev/disk3s1.To overwrite the disk, you must unmount the partition:
sudo diskutil unmount /dev/disk3s1
Determine what the raw device name is with this formula: add ‘r’ onto the front of the device name and remove the partition qualifier (ie. s1) from the end. For example if the name of the partition you saw in step 5 was ‘/dev/disk3s1’, then the name of the raw disk will be ‘/dev/rdisk3’. Be very careful with this step. Accidentally choosing the wrong device name will result in you overwriting that device… like your computer’s hard drive.
Use the following command to write the disk image to your SD card. Read the above step carefully to be sure you use the correct raw disk number here:
sudo dd bs=1m if=2015-05-05-raspbian-wheezy.img of=<raw-disk-number>
If the above command reports an error
(dd: bs: illegal numeric value)
, please change bs=1m to bs=1M.
Note that dd will not feedback any information until there is an error or it is finished; information will be shown and the disk will re-mount when complete. However if you wish to view the progress you can use ‘ctrl-T’; this generates SIGINFO, the status argument of your tty, and will display information on the process.
After the dd command finishes, eject the card:
sudo diskutil eject /dev/rdisk3
(or: open Disk Utility and eject the SD card)
Plug it into the raspberry pi, add a power source, keyboard, and screen and we’re on our way.