It’s very handy to have a bootable version of OS X on a thumb drive.
I have written how to do this using a program called DiskMaker X, and I have written about how to do it from the command line here, but after doing this a few times I find the most reliable method is the one outlined below. It uses Apple’s built-in disk utility.This works with any version of OS X. Mountain Lion, Yosemite, El Capitan etc. You’ll need an 8G USB thumbdrive.
1. Purchase or download the OS X Installer via the App store. It will look something like this:
2. Right-click on the installer and select “Show Package Contents. ” Open the ‘SharedSupport’ folder and find the file called “InstallESD.dmg”.
3. Insert the thumb drive and use disk utility to format it as Mac OS Extended (Journaled) with GUID Partition Table.
4. Use Disk Utility to ‘Restore’ the dmg file to a thumb drive. Select the thumndrive in disk utility and then go to the ‘Edit’ Menu of Disk Utility and select ‘Restore.’ It will prompt you for a disk image. Select the ‘InstallESD.img’ file.
This will make an OS X Installation USB drive like you buy from the Apple Store.