How to put a Linux ISO onto a USB stick and make it bootable on a Mac

Mac Disk Utility

So, you’ve got a mac computer and you want to put the ISO you just downloaded onto it. If you’ve used tools like UNetBootin before, then you’ll have found it a nice easy graphical way on a PC. Unfortunately, Mac users have to go through a few more hurdles to get an ISO image onto a USB stick in order to make it boot properly.

What are we trying to do here?

So, just to be clear, you have downloaded Linux (say Ubuntu) from the Ubuntu website. When you downloaded it you get a .iso file. This .iso file is a disk image. In the past, we’d ‘burn’ this image onto a blank CD or DVD. They weren’t really intended to be put onto USB sticks. USB sticks were more meant to pop regular files onto, not disk images.

However, this is 2016, and people don’t have CDRW drives any more, so let’s find out how to do this on your beloved mac. If you want a full tutorial on how to install Linux on a Mac computer, check out our guide.

Step 1: Download the ISO

This may seem obvious – but just in case you haven’t already downloaded your Linux distro, make sure you grab the right one for your machine (if it’s a new Mac, it’s going to be the 64-bit ISO image – the filename usually ends amd64.iso. If you are downloading Ubuntu, you can get it here: www.ubuntu.com/download/desktop

Step 2: Erase / Format / Initialise your USB Stick

It’s time to pop your USB stick in your Mac. Regardless of whether you have a blank USB stick, or one with lots of files, you are going to need to completely erase the contents of it. It’s commonly known as ‘Formatting’, but those Cupertino Cliques like to call it ‘Initialise’ instead 🙂

To initialise your USB stick, go to your Applications menu. In Utilities you’ll find an Apple app called ‘Disk Utility’. Launch that App, and you’ll see something similar to the below screenshot:

Mac Disk Utility
Mac Disk Utility

When you launch the app, find the USB stick icon. I’ve circled my one on the left hand side. Once you’ve found it, click on it (making sure you definitely have the right disk), and press Erase.

Erase USB Volume with Disk Utility on Mac
Erase (Initialise) the USB Stick

When you click Erase, you’ll get a few options. Make sure you choose ‘GUID Partition Map’ from the Scheme dropdown. I also gave it a name of UBUNTU so it is easy to identify in the following steps, however this is not required.

Click on the Erase button.

Step 3: Identify the disk and unmount it

Use diskutil to list the available disks
Use diskutil to list the available disks

Next up, open another inbuilt Utility on the Mac, this time it’s called Terminal. Launch that and you’ll get a blank text window.

Use the ‘diskutil list’ command as per the above screenshot (click the image to see it clearer).

IMPORTANT!

Take a note of what device name your newly initialised USB disk is. You can see in my screenshot that /dev/disk0 is the Mac’s hard drive, disk1 is the USB stick in my case (note the name I gave it, UBUNTU). It is VERY important that you take note of the correct disk here. If you use the dd program (coming up shortly) on your Mac’s hard drive, instead of the USB stick, your data will be toast! You have been warned!

Now that you have initialised the USB stick, unmount it. This is different from ejecting it, because we want to make the USB stick still visible to MacOS, we just want to stop it from being used by the OS.

To unmount the disk enter the following command:

diskutil unmountDisk /dev/diskX

Where diskX is the name you wrote down.

Step 4: Convert the image type to UDRW

Convert ISO to UDRW for use on the USB stick, from the mac
Convert the image to UDRW

Next you have to go into the folder which you downloaded the .iso file. If this is your Downloads folder you would type:

cd ~/Downloads

Note that it is case sensitive. You can use /home/yourusername instead of the ~

You can use the ls -l command to look at the files in the folder, just to make sure you are in the correct folder. In there, you should see the .iso file you downloaded in Step 1.

In order for the image to be writeable to the USB stick, you need to convert it into the UDRW image format. To do this we use the hdiutil command.

As you can see from the above screen shot, you type hdiutil convert -format UDRW -o

after the -o you provide a filename for the file you are about to create. It doesn’t really matter what it’s called. I called my one ubuntu1610.img. Note that MacOS will append a .dmg filename on the end of it because. Well, because MacOS!

Finally you provide the source file. The source file is of course the name of the file you downloaded from the web (ubuntu-16.10-desktop-amd64.iso, in my case).

So, the command in full is, for example:

hdiutil convert -format UDRW -o outputfile.img sourcefile.iso

When the command finishes, you’ll see the filename of the newly created UDRW disk image. You can copy this to the clipboard to help with the next step if you like.

Step 5: Put the disk image onto the USB stick

Use DD to write the image to the USB stick
Use DD to write the image to the USB stick

This is the vital stage. And this is where, if you didn’t take a note of that /dev/diskX bit in step 3 properly, you are going to be in a whole world of pain.

Still in the Terminal, carefully type the following:

sudo dd if=<UDRW_IMG_file_you_made_in_step_4.dmg> of=/dev/diskX bs=1m

It will ask you for your usual account password. Enter this and the dd command will start. Unfortunately, dd is about as old-school as it gets. Literally, you won’t see anything happening on your screen for quite some time. If your USB stick has a light on it, you’ll be seeing it flash, but otherwise you will have no idea that anything is happening. Hold on tight though, it’s doing its thing. Go find some wet paint to watch drying in the mean time.  I’ve tried this a number of times on different USB sticks. Some were done in 5 minutes, some took 25.

Once the process is finished, you’ll see a screen that looks pretty much like the one above. You’ll also likely get a popup from MacOS saying that the USB stick can’t be read by the computer. Do not click any of those buttons, no matter how tempting that ‘Eject’ button might look!

Step 6: Finishing up

It’s now time to eject the disk. We need to do this manually, to do so, enter the following command:

diskutil eject /dev/diskX

Replacing the X with the number you used earlier in this guide. It’s now safe to press the Ignore button on the window you saw in Step 5.

That’s it! You can now boot your computer (whether it’s your Mac, or another PC), using the newly created USB stick. To start it on your mac, reboot your mac, with the USB stick plugged in. Whilst it’s rebooting, hold down the ‘option’ key (sometimes it’s called Alt, depending upon your keyboard).

You should see a selection of disks to start up from. Your USB stick should be visible as a yellow disk icon, you can select the USB stick using the left/right arrow keys. Hit return to start up from it.

24 thoughts on “How to put a Linux ISO onto a USB stick and make it bootable on a Mac”

  1. Good guide, I followed all the instructions to the letter, and after ejecting the usb with diskutil eject /dev/disk2 and clicking on ignore for the dialog box with “the disk you inserted was not readable by this computer” it still comes up as an unreadable disk when I insert it again.
    – very frustrating (not your fault)

    1. Hi Stephen, the usb stick will never be readble by your mac, the filesystem is not in a format that it can read. To boot from the USB stick, restart your mac, hold down the option key while you hear the chime and youll see the option to boot from the USB media, select that with the arrow keys and you should be good to go. If not, try another USB as stick or maybe double check that the iso you downloaded is OK

  2. Excellent guide. After failing with UNetBootin several times, this worked like a charm. Appreciate the time you took to write it.

  3. Hi. Thank you for the detailed tutorial!

    Other tutorial on this matter tend to select MS-DOS(FAT) as format and Master Boot Record as scheme, which they explicitly tell people to do. What do you think of it?

    When I tried formatting as you tell, and `dd` the image file, the disk will become MS-DOS formatted disk somehow. Maybe around here lies an insight?

    1. Hi there,

      Indeed. The format (Mac HPFS vs FAT) doesn’t matter at all. This is because the information in the disk image that you write, effectively overwrites the disk with the ext filesystem. It is fairly important to choose a partition type however (GUID/GPT), as this will define how the image is placed onto a partition on the usb stick. This means that it will boot properly on newer macs. If you are using a Windows PC or an older Mac, then MBR will be fine too. Hope this helps.

  4. successfully done but my trackpad and keyboard is not working.

    Check out the following link to get your trackpad working, it’s near the bottom

    How to install Linux on a Mac (the definitive guide) – http://wp.me/p3LpA9-tl

  5. Hi,

    Would you be able to create a guide on how to boot to ubuntu server 16.04 (or any release) in mac using bootcamp? I am very much in awe of the steps and instructions you made. I hope you would consider it.

    cheers,

    1. Hi, the steps should be the same, pregnant probably simpler tough! Let me know how you get on and if you run into problems I can try and help

      1. Hi, does this mean that every time I boot my MacBook pro and I don’t hold on to the alt key, it will automatically go to the mac os? Also does this mean that If I want to boot in Ubuntu, I need the usb drive always connected on the MacBook pro, once it boots up, I need to hold the alt key and then choose the efi orange hd icon?

        1. You don’t need the usb stick in, but from recollection when you want to start Ubuntu you’ll need to hold the alt button down

  6. Hi again,

    I was able to install Ubuntu 16.04.2 using Unetbootin, reFind, and manual partition (create partition on existing HD using disk utility in MacOS first).

    My biggest challenge now is to make wifi work… Don’t get me wrong, I know I installed a server but this is a lab server and I need it to be stashed in a quiet corner or anywhere I can just put it… I tried this link in ubuntu on how to solve it but it seems that I can’t seem to connect to my home wifi network….
    https://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers/60395#60395

    Any ideas gladly appreciated.

      1. Hi,

        No, it worked ?

        I am more concerned on how I can dual boot MacOS and Ubuntu without using refit or refind…. I would just like to be able to normal boot to MacOS and only hold down the alt/option key if ever I want to boot to Ubuntu.

        Is that possible?

        1. AFAIR I believe it defaults to the last bored booted system. Further information on customising ReFIND can be found on their web site

          1. If that is the case, without reFit or reFind, can I use the native EFI boot system (pressing alt/option key) to choose what OS to boot? Or do I really need a boot manager for this kind of setup?

  7. Thanks for the guide. Many different ways out there and none seem to work. No luck here either 🙁 I’m getting an error when doing the hduitil that says ” -bash: syntax error near unexpected token `<' "
    Syntax is copied and pasted out of your text and of course the file names were changed to match mine. :-(((
    Any ideas?
    Thanks in advance.

    1. Those are there to help delineate the text – they aren’t literal, remove the < and >‘s and it will work fine.

  8. Hi,

    So once I boot up the mac and hold down the alt/option key, that is the only time I will see the yellow icon appear and then I can start on installing Ubuntu right? So after install, I will then remove the USB bootable drive and reboot the system. Naturally it will boot to the Ubuntu image right? What if I want to boot to my mac again? Do I just reboot and hold the alt/option key and from there I can see two icons? That is, one for mac and one for the Ubuntu OS?

    Thanks again for your replies.

  9. Hi,

    No, it worked ?

    I am more concerned on how I can dual boot MacOS and Ubuntu without using refit or refind…. I would just like to be able to normal boot to MacOS and only hold down the alt/option key if ever I want to boot to Ubuntu.

    Is that possible?

  10. This is a fantastic guide, thank you! I was able to succeed with it first try.

    I’m wondering if there’s a way to reliably create a backup of what’s on the USB drive, and restore that image later.
    I set up antiX Linux with persistence on the USB and I can create the backup image easily in Disk Utility but it doesn’t let me use it to restore.

  11. When I try to put the disk image onto my USB, I get this response:

    dd: /dev/disk2: Resource busy

    Anyway to get around this? I’ve been able to use this method to boot debian, but when I tried it with kali linux (larger file), it doesn’t seem to work.

    Any ideas on how I can get around this?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.