Creating a bootable USB from an ISO in Mac OS X

I needed to write a Linux installer ISO to a flash drive using my Mac. I found a couple of ressources online, and this is the recipe that ended up working for me.I needed to write a Linux installer ISO to a flash drive using my Mac. I found a couple of ressources online, and this is the recipe that ended up working for me.

NOTE: Replace /Users/username/ by whichever path your ISO image is stored in.

Step 1 – convert ISO to IMG format

The command to use is:

hdiutil convert -format UDRW -o “/Users/username/lubuntu.img” “/Users/username/lubuntu-16.04.2-desktop-i386.iso”

Step 2 – Identify USB device

The command to use is:

diskutil list

You should see your device in the list. In my case it was a 4 gb flash drive:

/dev/disk4 (external, physical):

#:                       TYPE NAME                    SIZE       IDENTIFIER   0:  FDisk_partition_scheme                        *4.0 GB     disk4   1:                 DOS_FAT_32 VERBATIM4               4.0 GB     disk4s

Step 3 – Wipe device

The command to use is:

diskutil partitionDisk /dev/disk4 1 “Free Space” “unused” “100%”

The expected result:

diskutil partitionDisk /dev/disk4 1 “Free Space” “unused” “100%”Started partitioning on disk4Unmounting diskCreating the partition mapWaiting for partitions to activateFinished partitioning on disk4/dev/disk4 (external, physical):   #:                       TYPE NAME                    SIZE       IDENTIFIER   0:      GUID_partition_scheme                        *4.0 GB     disk4   1:                        EFI EFI                     209.7 MB   disk4s1

Step 4 – unmount device (otherwise you get a denied on trying to write)

The command to use is:

diskutil unmountDisk /dev/disk4

Step 5 – write image to USB device to create bootable device

The command to use is:

time sudo dd if=/Users/username/lubuntu.img.dmg of=/dev/disk4 bs=1m

You will be prompted to provide your password to run the DD job. If successful, you will get a result at the end (it will take some time, the above bs parameter transfers 1 mb at a time), if successfull.

time sudo dd if=/Users/username/lubuntu.img.dmg of=/dev/disk4 bs=1m
Password:
882+0 records in
882+0 records out
924844032 bytes transferred in 1665.644938 secs (555247 bytes/sec)
real 27m50.118s
user 0m0.012ssys 0m9.962s

Once complete, the system will attempt to mount the disk, but won’t recognize it and will prompt you to either initialize or eject the disk. Select eject and you have a USB bootable flash drive ready for your install!

So, in sequence:

hdiutil convert -format UDRW -o “/Users/username/lubuntu.img” “/Users/username/lubuntu-16.04.2-desktop-i386.iso”

diskutil list

diskutil partitionDisk /dev/disk4 1 “Free Space” “unused” “100%”

diskutil unmountDisk /dev/disk4

time sudo dd if=/Users/username/lubuntu.img.dmg of=/dev/disk4 bs=1m