Raspberry Pi SD Card Imaging on Mac

There are many ways to write an image to an SD card for your Raspberry Pi. You can use NOOBS, or you can get software that will image your cards, or even purchase pre-imaged cards. All of these methods are designed to make the job easier, but it can be confusing with all those options.

If you've got a Mac, you can set up your Raspberry Pi using the terminal and some built-in tools.

The eLinux RPi Easy SD Card Setup page is anything but easy to understand. It currently states in several sections "ignore everything else on the page - this is the right way". The command-line method shown here actually appears on that page several times, but very inconsistently.

Here's the easy way to format your SD card with a Raspberry Pi image:

    # list the disks. Find the SD card. (ie: diskX)
diskutil list
    
    # now unmount the disk
diskutil unmountDisk /dev/diskX

    # and transfer the disk image
sudo dd bs=1m if=Downloads/theDiskImage.img of=/dev/rdiskX

Now again in slow-motion.

Identify the disk

On your Mac, open up Terminal and politely ask the Disk Utility to list the disks.

diskutil list

Now identify the disk (not partition) of your SD card. (diskX not diskXs1).

Pay attention here - you don't want to be writing to the wrong disk! This could be quite disastrous indeed. I will be using disk2 in the examples.

Here's a little nugget from the eLinux wiki:

Note: In OS X each disk may have two path references in /dev:

/dev/disk# is a buffered device, which means any data being sent undergoes extra processing.

/dev/rdisk# is a raw path, which is much faster, and perfectly OK when using the dd program.

Alrighty. So we have identified the disk number (disk2 for me), and we will remember to add an r to the beginning to specify the raw disk. So I will be using rdisk2.

Unmount the Disk

The disk needs to be unmounted in order to write the image. Use the disk you identified (without the r ).

diskutil unmountDisk /dev/disk2

Copy the disk image to the SD Card

Now copy the downloaded disk image to the card

sudo dd bs=1m if=Downloads/theDiskImage.img of=/dev/rdisk2

This can take a couple of minutes depending on the size of the image, and transfer speeds. There's no progress bar, so just sit tight. When it's done, eject the disk.

sudo diskutil eject /dev/rdisk2

The SD card is now ready to be used on the Raspberry Pi.


You can also image bootable USB sticks this way for installing operating systems or for a FreeNAS USB system disk.