MacBook – How to make a bootable USB OS X installer on a Mac

bootdisk-formatmacbook prousb

Does anyone have a Terminal command-line recipe for making a new bootable USB flash drive for one of the new MacBook Air's? Is there a way to dd copy the USB boot device that comes in the box and make the new copy bootable? I'd like to make a new backup copy of the USB rescue device for my MBA, preferably on a much larger flash drive with room for a backup of some of my working directories.

Added:

And is it possible to make, not just a rescue drive, but a bootable USB drive that will boot a fully updated version of the OS (say 10.6.8 or later)? If so how on a MacBook Air 11, and how big a USB stick will this require?

Best Answer

If Apple's supported method of using the createinstallmedia tool doesn't work, you can try other options below:

With OS X El Capitan, Yosemite, or Mavericks, you can use a USB flash drive or other removable media as a startup disk from which to install OS X.


Really - try the above if you can, but as an alternative, here is a simple recipe for making a USB version of the OS X installer + associated tools. (Migration Assistant, Disk Utility, Network Utility, Terminal (that auto mounts your internal drive as needed), Firmware Utility and Password Reset Utility.

1) Use Disk Utility backup/restore to image whatever Snow Leopard DVD you prefer onto a HFS+ formatted GUID USB drive. I usually first create a IMG of the DVD, but it should work in one shot. Watch for restore errors - you may need the Disk Utility menu command Images -> Scan images for restore... before restoring an IMG to the USB drive.

2) bless the USB drive by selecting it in Startup Disk or using the command line. (Note - the manual page for bless may be moved, but the command still works on Mojave to bless an alternate boot. You can’t set this to be the default boot with System Integrity Protection but for this use, bless should still work.

It's not that hard to make a bootable image and far more secure to DIY. It also avoids the need of downloading commercial software from the internet. Happy media shifting all!

If you simply want a bootable thumb drive, just install OSX onto that volume - turning off all the extras you may not need. You can have your USB on one side and the USB install disk on the other to make your bootable drive ensuring all the Air drivers are on your USB bootable drive (which is often an issue when using another install's image - sometimes the drivers are not all there on older builds of the OS)

The best trick I have when you don't have enough space on USB to create the final updated version is to stage the bootable image by install first to a 25G partition on an external hard drive.

You can finish installing with lots of free space on the HS, run all the updates newer than your installer (10.6.8 for example), make an admin account, install the tools and apps you need. At the end of the process, you then thin out the things you don't need. DaisyDisk or WhatSize will show you all the large files and libraries. You can safely get rid of a lot of iLife and the associated Application Support. WhatSize has many options to strip out unneeded files, localizations and PPC code. Once you have slimmed down the bootable image on the HD partition, use the trick below to get it on the USB drive. Leopard was a tight fit in 8G but Snow Leopard is lighter and doesn't need to diet as much.

Edit: Here are terminal commands for rolling your own installer like the (read-only) one that ships with current MacBook Air. I have a Snow Leopard DVD as /dev/disk5 and my USB is /dev/disk6. The man pages for diskutil and asr are helpful if you run into little gotchas or have different needs than a basic one partition drive.

$diskutil list
/dev/disk5
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *7.8 GB     disk5
   1:        Apple_partition_map                         30.7 KB    disk5s1
   2:         Apple_Driver_ATAPI                         1.0 GB     disk5s2
   3:                  Apple_HFS Mac OS X Install DVD    6.7 GB     disk5s3
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   *8.5 GB     disk6
$diskutil partitionDisk disk6 GPT HFS+ MacUSB 100%
Started partitioning on disk6
Unmounting disk
Creating partition map
Waiting for disks to reappear
Formatting disk6s2 as Mac OS Extended with name MacUSB
Finished partitioning on disk6
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *8.5 GB     disk6
   1:                        EFI                         209.7 MB   disk6s1
   2:                  Apple_HFS MacUSB                  8.2 GB     disk6s2
$sudo asr restore --source /dev/disk5s3 --target /dev/disk6s2 --erase
    Validating target...done
    Validating source...done
    Erase contents of /dev/disk6s2 (/Volumes/MacUSB)? [ny]: y
    Validating sizes...done
    Restoring  ....10....20....30....40....50....60....70....80....90....100
    Verifying  ....10....20....30....40....50....60....70....80....90....100
    Remounting target volume...done
$sudo bless --mount /Volumes/Mac\ OS\ X\ Install\ DVD\ 1 --setBoot

Note: that the USB drive was renamed to be the same as the installer and the mount point in /Volumes has a space and a 1 tacked on the end.

Note: SIP ensures the —setBoot portion of the commands above will fail. Remove that portion and/or ignore any errors. You will need to select the USB another way than having bless perform a one step command. This is another reason to just use createinstallmedia from Apple to perform this.

Related Question