How to write Raspbian OS image file to SD cards on Apple macOS / OS X

See all macOS (formerly Mac OS X or OS X) Unix related Howtos/Tutorials
I got a Raspberry PI 3 or 4 from my friend. I am a long term macOS user. How do I write Raspbian OS image file to SD card using macOS or OS X?

Raspberry PI 3 or 4 is a small and affordable SBC (Single-board computer) that you can use to learn programming or Linux operating system for fun and profit. This tutorial shows how to download and install Raspbian OS on SD cards when using Apple macOS or OS X.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Unix terminal
Category Raspberry Pi
OS compatibility macOS OS X Unix
Est. reading time 3 minutes

Steps to write Raspbian OS image file to SD cards:

  1. Find your SD card name such as /dev/disk2
  2. Unmount /dev/disk2
  3. Write raspbian-jessie.img file using a dd command
  4. sudo dd bs=1M if=fileName.img of=/dev/rdiskN
  5. Finally the eject the SD card and insert into your Raspberry PI 3 computer

Step 1 – Download Raspbian

Visit this page to grab the latest version of OS. I downloaded a file named One can double click to extract the zip file or use the unzip command:
$ unzip
This resulted into a file named 2017-06-21-raspbian-jessie.img. You need to use 2017-06-21-raspbian-jessie.img for writing on SD card.

Step 2 – Find your SD card name on macOS

First, insert the SD card in your Mac. Open the terminal app and type the following diskutil command:
diskutil list
Sample outputs:

Fig.01: Identify the SD card on macOS

Fig.01: Identify the SD card on macOS


  • I have 16 GB SD card on my system.
  • I have identified the disk /dev/disk2 as my SD card
  • Do not use the partition such as /dev/disk2s1, /dev/disk2s2 and so on.
  • Depend upon your Mac config your SD card name may be /dev/disk3 or /dev/disk4 and so on. Use the SD card size to identify correct device name.

Step 3 – Unmount your SD card

To unmount a single volume named /dev/disk2, run:
diskutil unmountDisk /dev/disk2
Sample outputs:

Unmount of all volumes on disk2 was successful

Step 4 – Write the image to your SD card

Warning: The dd command overwrite your SD card. If you give the wrong disk name, the following command will wipe out your data and macOS hard disk. You have been warned. Please keep backups and be careful while typing commands.

You need to use the dd command as follows to write downloaded 2017-06-21-raspbian-jessie.img file to /dev/rdisk2 (remember to replace /dev/disk2 with /dev/rdisk2):
$ sudo dd bs=1m if=2017-06-21-raspbian-jessie.img of=/dev/rdisk2
Sample outputs:

4444+1 records in
4444+0 records out
4659871744 bytes transferred in 385.614770 secs (12084267 bytes/sec)

Step 5 – Eject a disk

To safely remove the SD card and make it ready for use, type the following command:
$ diskutil eject /dev/rdisk2
Sample outputs:

Disk /dev/rdisk2 ejected

Now, remove the SD card and insert into your Raspberry PI 3 computer. Power it on and enjoy your new operating system. Here is my desktop:

Fig.02: Raspberry PI powered by Raspbian Jessie

Fig.02: Raspberry PI powered by Raspbian Jessie (click to enlarge)

And there you have it, Raspbian Jessie installed and running. Happy programming.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

4 comments… add one
  • Leaman Crews Jun 28, 2017 @ 3:03

    Excellent post! I have been using this method to write .iso files to USB sticks and SD cards in OS X/macOS for a long time now. But I recently discovered a nice GUI frontend for this process, Apple Pi Baker:

  • Biggles Jun 28, 2017 @ 6:40

    … or make your life so much easier and use Etcher. Early versions were a bit flaky on the Mac but recent ones work flawlessly.

    • 🛡️ Vivek Gite (Author and Admin) Vivek Gite Jun 28, 2017 @ 17:31

      Thanks for Etcher. To be honest I stick with default. But, I guess if you are a new user, you might wanna try out easy to tools.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.