I'm doing a lot more development work on my MacBook Pro these days, and decided it was time for a fresh OS X install after a couple of years of usage. But, before I could do that, I needed to create a bootable USB drive so I could wipe the disk clean and boot the machine up again. Here's how it's done.

Download OS X

Apple only sells OS X Mountain Lion as a download; no CD-ROM or DVD. There are two downsides to this; 1) It takes a long time to download 4.35GB, and 2) It self destructs after installation. So, even if you've already updated to the latest OS X, you're going to have to download that monster again in order to make this boot disk. Here's how to avoid that in the future:

Format a bootable OS X USB drive.
OS X Mountain Lion in the Mac App Store.

Open the App Store within your Mac, and find the latest OS X in the "Purchased" tab. From there, just click the download button, but don't install it. You'll probably want to make sure you have a solid Internet connection (not a public Wifi) before you hit that download button. After the download starts go back to another machine and keep yourself busy emptying your inbox or something, because this is going to take a while; It took over an hour on my home connection. And remember, don't install it; it will self destruct if you do, and you'll have to wait for that download again.

Once I finally got OS X Mountain Lion downloaded, I stored it away on an external drive I use for archival purposes. That way, I won't have to do this again.

Prepare the USB Drive

Plug your target USB drive into your Mac and open the Disk Utility (which is in Applicaions/Utilities/). From Disk Utility find your USB drive in the left hand pane. As you can see in the screenshot, mine was called "7.76 GB Kingston DT 10...". Click on that and then choose 1 Partition in the Partition Layout menu. Under that, click Options and choose GUID Partition Table, which will make the USB drive bootable. On the right side, choose Mac OS Extended (Journaled) from the Format menu and then click Apply. It goes without saying, that everything on your USB drive is going to be wiped out at this point.

Format a bootable OS X USB drive.
Formatting an OS X bootable USB drive.

Create The Bootable USB Drive

The App Store should have downloaded the OS X installer to the /Applications/ directory in the root of your computer. The full path for me was /Applications/Install OS X Mountain Lion.app. Use Finder to to locate the download and then right click on it (that's a two finger click on the touchpad). Choose Show Package Contents from the menu. Navigate through to the Contents/SharedSupport/ folder, where you'll find InstallESD.dmg. That's our baby! Now drag it over into the left hand pane of the Disk Utility window.

Format a bootable OS X USB drive.
After dragging the InstallESD.dmg image into the Disk Utility.

Once you have InstallESD.dmg in the Disk Utility, click on it and choose the Restore tab. Then just choose your USB drive as the Destination (by dragging it from the left pane). Click Restore and let the computer do the rest. It will ask you if you want to erase the contents of your USB drive; since you don't have anything on it, the answer is a confident "yes".

Create the bootable OS X USB drive.
Creating the bootable OS X USB drive.

Booting from Your Bootable USB Drive

Plug the drive into your machine, and turn in on while holding down the option key until it boots to the startup screen. The screen will ask you if you want to boot from your normal hard drive, the recovery portion of your hard drive, or the USB drive.