Created
November 28, 2019 11:08
-
-
Save mattintosh4/6db53c2ce2bf1327f05e14e82216356a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -u | |
set -x | |
name="High Sierra" | |
tempfile=$(mktemp -u) | |
hdiutil create -size 8g -fs HFS+J -layout SPUD ${tempfile} | |
hdiutil attach ${tempfile}.dmg -noverify -nobrowse -mountpoint "/Volumes/Install macOS ${name}" | |
sudo "/Applications/Install macOS ${name}.app/Contents/Resources/createinstallmedia" --volume "/Volumes/Install macOS ${name}" | |
hdiutil detach "/Volumes/Install macOS ${name}" | |
hdiutil resize -size $(hdiutil resize -limits ${tempfile}.dmg | awk 'END { print $1 }')b ${tempfile}.dmg | |
hdiutil convert ${tempfile}.dmg -ov -format UDTO -o "Install macOS ${name}" | |
rm ${tempfile}.dmg | |
mv "Install macOS ${name}".{cdr,iso} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment