Skip to content

Instantly share code, notes, and snippets.

@lamlion
Last active November 18, 2020 21:51
Show Gist options
  • Save lamlion/10af6c25e0fb415916f93c14b4a927de to your computer and use it in GitHub Desktop.
Save lamlion/10af6c25e0fb415916f93c14b4a927de to your computer and use it in GitHub Desktop.
Create MacOS ISO
#!/bin/bash
# Install OSX Mojave through App Store. After downloading, the "InstallESD" is automatically mounted, which causes this script to fail.
# Therefore, "/Volumes/InstallESD" should be unmounted before running this script!
# Summary of instructions
#1 Download Mojave from App Store
#2 open terminal and run "umount /Volumes/InstallESD"
#3 make script executable: "chmod +x make_mojave_iso.sh"
#4 Run "./make_mojave_iso.sh"
#5 After running this script, if successful, you end up with "Mojave.iso" on your desktop
hdiutil attach /Applications/Install\ macOS\ Mojave.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/mojave
hdiutil create -o /tmp/MojaveBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/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 /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -R /Volumes/mojave/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/mojave/
mv /tmp/MojaveBase.cdr.dmg /tmp/BaseSystem.dmg
# Restore the 10.14 Installer's BaseSystem.dmg into file system and place custom BaseSystem.dmg into the root
hdiutil create -o /tmp/Mojave.cdr -size 8965m -layout SPUD -fs HFS+J
hdiutil attach /tmp/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
cp /tmp/BaseSystem.dmg /Volumes/OS\ X\ Base\ System
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil convert /tmp/Mojave.cdr.dmg -format UDTO -o /tmp/Mojave.iso
mv /tmp/Mojave.iso.cdr ~/Desktop/Mojave.iso
rm /tmp/Mojave.cdr.dmg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment