Create an Ubuntu image for a Raspberry Pi on MacOS

Key Value
Summary How to create a bootable microSD card to run Ubuntu on your Raspberry Pi
Categories iot
Difficulty 2
Author Peter Mahnke


Duration: 1:00

In this tutorial, we will walk you through creating a bootable Ubuntu microSD card for your Raspberry Pi .

What you’ll learn

How to create a bootable microSD card to run Ubuntu on your Raspberry Pi

What you’ll need

:warning: Warning
Following these steps will erase any existing content on the removable drive!

Please note
The following instructions are for MacOS users. We also have tutorials for Ubuntu and Windows users.

On your MacOS machine

Duration: 5:00

  1. Download the Ubuntu image for your device in your **Downloads** folder

  2. Insert your microSD card

  3. Open a terminal window (Go to Application » Utilities, you will find the Terminal app there), then run the following command:

    diskutil list

  4. In the results, identify your removable drive device address, it will probably look like an entry like the ones below:

#:     TYPE NAME                       SIZE         IDENTIFIER
0:      GUID_partition_scheme         *500.3 GB     disk0

#:     TYPE NAME                       SIZE         IDENTIFIER
0:     Apple_HFS Macintosh HD         *428.8 GB     disk1
Logical Volume on disk0s2
Unlocked Encrypted

#:     TYPE NAME                       SIZE         IDENTIFIER
0:     FDisk_partition_scheme         *7.9 GB          disk3
1:     DOS_FAT_32 NO NAME              7.9 GB          disk3s1

Your removable drive must be DOS_FAT_32 formatted. In this example, /dev/disk3 is the drive address of an 8GB microSD card.

  1. Unmount your microSD card with the following command:

    diskutil unmountDisk < drive address >

  2. When successful, you should see a message similar to this one:
    Unmount of all volumes on < drive address > was successful

  3. You can now copy the image to the microSD card, using the following command:
    sudo sh -c 'gunzip -c ~/Downloads/< image file > | sudo dd of=< drive address > bs=32m'

    When finalised you will see the following message:

3719+1 records in
3719+1 records out
3899999744 bytes transferred in 642.512167 secs (6069924 bytes/sec)
  1. You can now eject your microSD card

That’s all folks!

Duration: 1:00

You did it!

Now you can put the microSD card in your Raspberry Pi and boot it up.

1 Like

Should be

1 Like

Thanks for the catch @maxaltena, let us know if you spot anything else :slight_smile:

Should be: The following tutorial is for macOS users.

MacOS should be stylised as macOS

1 Like

Thanks, fixed. I was posting all three at once and messed up.

1 Like

The guide was mostly good. A couple of things I would comment on though:

I would expand a bit on the importance of the FAT32 partitioning. My SD card had a Linux partition already on it, and a FAT32 partition that was only 280MB… and that’s all that MacOS saw until I selected the Show All Devices option in Disk Utility: image

The other comment is in regard to the dd command. It takes a long time to run. I suggest opening Activity Monitor to check the progress of it. Sort by Process Name and look for dd

The line to write the image to USB is incorrect.


> |
should be replaced with

So the full command is

sudo sh -c ‘gunzip -c ~/Downloads/< image file | sudo dd of=< drive address > bs=32m’

There isn’t any direction on how to set up the first-time login and password. This may be helpful, I am stuck at this after following instructions (which were otherwise very good)

The image downloads as a compressed .xz file … The instructions do not have a step about extracting the image before moving to the usb drive… Does it need to be extracted first?

Also getting the following erros: Chriss-Mac-mini:~ master$ sudo sh -c ‘gunzip -c ~/Downloads/ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz | sudo dd of=/dev/disk4 bs=32m’


dd: bs: illegal numeric value

-c: ‘gunzip: command not found

Chriss-Mac-mini:~ master$ sudo sh -c ‘gunzip -c users/master/Downloads/ubuntu-19.10.1-preinstalled-server-arm64+raspi3.img.xz | sudo dd of=/dev/disk4 bs=32m’

-c: ‘gunzip: command not found

dd: bs: illegal numeric value

I would strongly suggest using /dev/rdiskX to write to instead of /dev/diskX. In macOS the ‘diskX’ device is buffered while the ‘rdisk’ device is not. dd can be up to 20x faster writing to the raw device instead of the buffered device.