Creating a bootable Linux USB installer disk from an ISO on the Mac


I got myself a new pc to learn Linux and do all my crazy experimenting on.

What’d I use as my primary OS? Why CentOS, ofcourse.
Two reasons …

  • These are long term, slow stable releases, just the way I like my software to be.
  • My last exposure to Linux was Red Hat Linux v5 & 6 way back when[1]. CentOS looks familiar enough to ease my apprehensions.

First step on the way, was getting the OS installed on the machine.
Slight hiccup though. I had the ISO and no optical drive!

I’d disconnected and given away the optical drive on my server, because I thought,[2] I didn’t need a device sucking power, needlessly.
And ofcourse my trusty old MacBook Air has none.

So how do I do about installing?

Well, I got the ISO down, via bittorrent and then “burnt” it to a USB drive, making myself a bootable USB installer.

How? Well here goes[3]

  • Get the ISO[4].
  • Convert the read only ISO to a read/write image using hdiutil[5] like so.
    sudo hdiutil convert -format UDRW -o 'call-it-what-you-want.img' 'path-to-iso-file.iso
    It’d be simpler if you’re in the same directory as your iso file. Saves you making booboos with paths.
  • You’ll end up with an img file (it might also get appended with a .dmg extension, so that you end up with CentOS.img.dmg. Doesn’t matter.)
  • Partition your USB drive so that it’s empty.[6]
    diskutil partitionDisk /dev/disk2 "Free Space" "unused" "100%"
  • Write the converted image file to your USB drive using dd.
    sudo dd if='path to your new img file' of=/dev/disk2 bs=1m
  • Once dd is done, the USB installer’s ready.

You can then go right ahead and use it to install CentOS.

  1. 1999 — 2000. Yes, I’m that old. ↩︎

  2. Don’t laugh! ↩︎

  3. Instructions for reference purposes only. Be careful. Don’t be a cargo cult sysadmin. Don’t blame me, if you hose your system. ↩︎

  4. that you think you’d need. I got the everything ISO. If you’re comfortable doing everything over your fast broadband connection, a minimal ISO should suffice. ↩︎

  5. You’re obviously doing this in the terminal. Just thought I should tell you that :P ↩︎

  6. Your device might not be disk2. Find out what it is by using “diskutil list” ↩︎