Need to create a thumb drive installer for Mac OS? This script will help you out
#!/bin/sh
# MacOS_InstallUSB.sh
#
#
# Created by David Kittell on 4/7/17.
#
# Variables - Start
# Text Variables - Start
txtund=$(tput sgr 0 1) # Underline
txtbld=$(tput bold) # Bold
txtbldund=${txtund}$(tput bold) # Bold Underline
txtbldred=${txtbld}$(tput setaf 1) # Bold Red
txtbldgreen=${txtbld}$(tput setaf 2) # Bold Green
txtbldblu=${txtbld}$(tput setaf 4) # Bold Blue
txtbldwht=${txtbld}$(tput setaf 7) # Bold White
txtrst=$(tput sgr0) # Reset
# Text Variables - Stop
# Variables - Stop
clear
echo "${txtbld}Current Volumes:${txtrst}"
ls /Volumes | grep -v Recovery\ HD | grep -v MacSSD | grep -v Macintosh\ HD
echo "\n${txtbldund}Type the name of volume/drive you want to setup, followed by [ENTER]:${txtrst}"
read sVolume
echo "\n${txtbldred}We will now format ${sVolume}\nARE YOU SURE?, type y for Yes or n for No followed by [Enter]:${txtrst}"
read sConfirmation
case $sConfirmation in
[yY])
echo "\n${txtbldgreen}We will now format ${sVolume}${txtrst}"
# sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/${sVolume} --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/${sVolume} --nointeraction
say "Mac OS Installation Drive Is Ready"
;;
*)
echo "\n${txtbldgreen}No changes have been made.${txtrst}"
;;
esac
Originally Posted on April 7, 2017
Last Updated on September 2, 2021
Last Updated on September 2, 2021
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.