Write an image to SD card using Mac OS X

Writing a Raspberry Pi image to SD cardThis is a frequent question on a lot of Raspberry Pi forums where people need to create bootable SD cards, but applies to anything you might want to write an image file for. Using Mac OS X it’s possible to write an image directly from the command line with no additional software, using a command called dd. A quick word of warning before we start, it’s important to check and double check before writing an image – especially if you’re not familiar with the commands. Accidently selecting the wrong disk could destroy your data and can really spoil your day!


1.  Insert your SD card (or other media you are wanting to write to) and check it’s visible in finder.

2.  Open up Terminal (it’s in the utilities) and wait for the prompt to appear. The first command we are going to run is to identify the device we want to write to:

Diskutil list

This will display a list of disks on your system. You should be able to identify your target device by size and manufacturer, but if you are unsure at all eject your device and run the command again to see which one has disappeared. Better safe than sorry! Make a note of the number of the disk you are interested in.

3.   Next we need to unmount your target disk before writing to it. Use the following command:

diskutil unmountDisk /dev/diskX (where X is the number you noted earlier).

This should return a message saying that the unmount operation was successful.

4.  The last command we run is the dd command to actually write the image. If you’re happy to proceed then enter the following:

sudo dd bs=1m if=XXX.img of=/dev/diskX (where XXX.img is the path to the image file you want to write and diskX is the number you previously noted).

You may be prompted for your password at this point, as the command is being run with elevated security privileges. You won’t get any immediate feedback in Terminal when you enter this command, so if nothing happens don’t worry. Once the write process has finished Terminal will return to the prompt and you can close it down.

That’s it! Assuming all went well you’ve now got a freshly imaged device ready to go.



Mike Hudson

Mike Hudson is a Lead Cyber Security Analyst living and working in Kingston Upon Hull. With extensive experience in Microsoft and Apple technologies, ranging from desktop OS’s to Server OS’s and hardware. By day working as part of an infrastructure team, and by night ridding the world of IT issues through blog posts..

%d bloggers like this: