Skip to content

Instantly share code, notes, and snippets.

@mattintosh4
Created October 21, 2019 10:15
Show Gist options
  • Save mattintosh4/62972336ac0b89ac6b7fa706a77b6c95 to your computer and use it in GitHub Desktop.
Save mattintosh4/62972336ac0b89ac6b7fa706a77b6c95 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
set -u
set -x
tempfile=$(mktemp -u)
hdiutil create -size 8g -fs HFS+J -layout SPUD ${tempfile}
hdiutil attach ${tempfile}.dmg -noverify -nobrowse -mountpoint /Volumes/Install\ macOS\ Mojave
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --nointeraction --downloadassets --volume /Volumes/Install\ macOS\ Mojave
hdiutil detach /Volumes/Install\ macOS\ Mojave
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 Mojave'
rm ${tempfile}.dmg
mv Install\ macOS\ Mojave.{cdr,iso}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment