Skip to content

Instantly share code, notes, and snippets.

@thewellington
Last active September 22, 2016 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewellington/4452ca7d9adf66b2856e to your computer and use it in GitHub Desktop.
Save thewellington/4452ca7d9adf66b2856e to your computer and use it in GitHub Desktop.
Create OS X Boot Disk
#!/usr/bin/env bash
#
#
# create boot disks from OSX Installers
#
# This script makes the following assumptions when creating a bootable USB drive.
# 1. You have downloaded the installer from the AppStore, and it is sitting in
# the /Applications directory (the default location.)
# 2. you have a freshly formatted USB drive with the following characteristics:
# - at least 8GB in size
# - Formatted "Mac OS Extended (Journaled)"
# - GUID Partition Map
# - the volume is titled "Untitled"
#
# Execute using the following command:
# create_osx_boot.sh < Mavericks | Yosemite | ElCapitan | Sierra >
#
# v.2016-09-22 by bill@wellingtonnet.net
########################################################################################
# set some variables
if [[ "$1" = "Sierra" ]]; then
APPLICATION_PATH='/Applications/Install macOS Sierra.app'
elif [[ "$1" = "ElCapitan" ]]; then
APPLICATION_PATH='/Applications/Install OS X El Capitan.app'
elif [[ "$1" = "Yosemite" ]]; then
APPLICATION_PATH='/Applications/Install OS X Yosemite.app'
elif [[ "$1" = "Mavericks" ]]; then
APPLICATION_PATH='/Applications/Install OS X Mavericks.app'
else
echo "sorry: no option available for ${1}"
exit
fi
INSTALLER_PATH="$APPLICATION_PATH/Contents/Resources/createinstallmedia"
DESTINATION_VOL='/Volumes/Untitled'
# ok let's get to work
sudo "${INSTALLER_PATH}" --volume "${DESTINATION_VOL}" --applicationpath "${APPLICATION_PATH}" --nointeraction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment