Making a bootable USB from an .iso image on Mac OS X

Introduction

The purpose of this blog post describe how to take an ISO image that you’ve downloaded that contains a bootable file system intended to be burned onto a
CDROM and instead put it on a USB key so that a machine with the ability to boot from USB keys can boot it the exact same as if it were a CDROM.

NOTE: Intel Based Apple Machines contain an EFI BIOS that CANNOT boot USB keys. You will not be able to put your OS X .iso file onto a USB key and install it onto an Apple machine.
We’ll be doing most of this from a terminal, with the help of disk utility for some things.

Prepare the USB Drive

We’re going to wipe the partition structure on the USB key.
WARNING! THIS WILL DESTROY ALL DATA ON THE KEY!
Open up Disk Utility (it’s in /Applications/Utilities/).

1
Now do the following:

  1. Select the USB key (select the root device, not its partitions)
  2. Select the partition section at the top
  3. Change the Scheme to 1 Partition
  4. Change the Format to Free Space
  5. Click Apply

You will get a confirmation dialog appear ensuring you really want to delete all data on the key, choose Partition.
Once it’s completed you can quit out of Disk Utility.
Update: The purpose of doing this is mainly to ensure that the USB key is in a consistent known state and also to ensure that any volumes are not mounted by OS X. It is not required and you can skip it if you’d rather just unmount the volumes yourself.

Preparing the ISO image

Now that our USB key is ready, we need to get our .iso image into a format that we can copy to it. Open up a Terminal (it too is in /Application/Utilities, and I’ll assume you know how to use the terminal).
Now, convert the image from a ISO to a Read/Write Universal Disk Image Format (or UDRW). Here I’m using the Debian 6.0.7 Net Installation ISO, but you can use anything else that’s an ISO file.
hdiutil convert -format UDRW -o debian-7.1.0-amd64-netinst.img debian-7.1.0-amd64-netinst.iso2
Created: /Users/Desktop/Images/ debian-7.1.0-amd64-netinst.img.dmg.
Once completed this will create the .img file. The hdiutil function likes to append a .dmg suffix to the file so it will probably end up .img.dmg after conversion. !

Copy the image to the USB key

We’re finally here. The easy part, actually copying the image to the USB key. !
First run diskutil list to get a listing of the disks in your machine so you can identify the USB key. It will look like this:
Here mine’s /dev/disk1.
3
Update: We want to use the RAW disk device so that our copy will happen much faster because the RAW disk device provides unbuffered access to the device (See this Apple mailing list post for more info). This is accomplished by simply prepending ‘r’ to the device so that /dev/disk1 is going to become /dev/rdisk1.
Update 2: Specifying a blocksize of 1m will also significantly speed things up.
Next we use the dd command to copy the image over.
4
On the command line we specify the Input File using if= and the Output File using of= and dd will copy the data from input to output, block by block.

And now the USB is working as a boot device.

Leave a Reply

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

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