Skip to content

Instantly share code, notes, and snippets.

@woodcockjosh
Created April 7, 2019 15:54
Show Gist options
  • Save woodcockjosh/898bbc3bdd40da23c6d49cb059deb8bd to your computer and use it in GitHub Desktop.
Save woodcockjosh/898bbc3bdd40da23c6d49cb059deb8bd to your computer and use it in GitHub Desktop.
!/usr/bin/env bash
hdiutil attach /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave
hdiutil create -o ./MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach ./MojaveBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm -rf /Volumes/OS\ X\ Base\ System/System/Installation/Packages
sudo mkdir -p /Volumes/OS\ X\ Base\ System/System/Installation/Packages
sudo cp -R /Volumes/mojave/Packages/* /Volumes/OS\ X\ Base\ System/System/Installation/Packages/
hdiutil detach /Volumes/macOS\ Base\ System
hdiutil detach /Volumes/mojave/
mv ./MojaveBase.cdr.dmg ./BaseSystem.dmg
# Restore the 10.13 Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
hdiutil create -o ./Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
hdiutil attach ./Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ Mojave\.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
sudo cp ./BaseSystem.dmg /Volumes/OS\ X\ Base\ System
hdiutil detach /Volumes/macOS\ Base\ System
hdiutil convert ./Mojave.cdr.dmg -format UDTO -o ./Mojave.iso
mv ./Mojave.iso.cdr ./Mojave.iso
rm ./Mojave.cdr.dmg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment