[Making a bootable USB key from an .iso image on Mac OS X](http://borgstrom.ca/2010/10/14/os-x-bootable-usb.html)

2016/2/18 posted in  OSX

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-6.0.7-amd64-netinst.img debian-6.0.7-amd64-netinst.iso 
Reading Master Boot Record (MBR : 0)…
Reading Debian 6.0.7 amd64 1             (Apple_ISO : 1)…
Reading  (Windows_NTFS_Hidden : 2)…
.....................................................................................................................................................................................................................................................
Elapsed Time:  2.054s
Speed: 81.8Mbytes/sec
Savings: 0.0%
created: /Users/evan/Downloads/debian-6.0.7-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:

$ diskutil list
/dev/disk0
   #: TYPE NAME SIZE IDENTIFIER
   0: GUID_partition_scheme *250.1 GB disk0
   1: EFI 209.7 MB disk0s1
   2: Apple_HFS Macintosh HD 249.7 GB disk0s2

/dev/disk1
   #: TYPE NAME SIZE IDENTIFIER
   0: *1.0 GB disk1

Here mine’s /dev/disk1.

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.

$ dd if=./xbmc-9.11-live-repack.img.dmg of=/dev/rdisk1 bs=1m

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.

Once it’s completed you can exit Terminal and remove the USB key from your OS X machine, it should now be able to bootup your ISO on another machine.