Skip to content

Instantly share code, notes, and snippets.

@gilesdring
Last active August 10, 2020 16:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilesdring/694cd758ca59032ddb2d07ae929bd5de to your computer and use it in GitHub Desktop.
Save gilesdring/694cd758ca59032ddb2d07ae929bd5de to your computer and use it in GitHub Desktop.
Instructions to create installation media for macos

High Sierra (10.13)

hdiutil create -o /tmp/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ High\ Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
hdiutil detach /Volumes/OS\ X\ Base\ System
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso

https://tylermade.net/2017/10/05/how-to-create-a-bootable-iso-image-of-macos-10-13-high-sierra-installer/

hdiutil create -o ~/Desktop/HighSierra.cdr -size 5200m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil detach /Volumes/Install\ macOS\ High\ Sierra
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/HighSierra.iso

Sierra (10.12)

https://www.howtogeek.com/289594/how-to-install-macos-sierra-in-virtualbox-on-windows-10/

hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
hdiutil detach /Volumes/install_app
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil convert /tmp/Sierra.cdr.dmg -format UDTO -o /tmp/Sierra.iso
mv /tmp/Sierra.iso.cdr ~/Desktop/Sierra.iso

hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Volumes/Recovery/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --applicationpath /Volumes/Recovery/Install\ macOS\ Sierra.app

hdiutil detach /Volumes/Install\ macOS\ Sierra
mv /tmp/Sierra.cdr.dmg ~/Desktop/InstallSierra.10.12.0.dmg
hdiutil convert ~/Desktop/InstallSierra.10.12.0.dmg -format UDTO -o ~/Desktop/Sierra.10.12.0.iso
mount
hdiutil detach /Volumes/OS\ X\ Install\ ESD/
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/OS\ X\ Install\ ESD/
hdiutil detach /Volumes/Install\ macOS\ Sierra/
hdiutil convert ~/Desktop/InstallSierra.10.12.0.dmg -format UDTO -o ~/Desktop/Sierra.10.12.0.iso
set -xe
# Obviously, change this to the correct OS name
os_name=Mojave
hdiutil create -o "/tmp/${os_name}.cdr" -size 7316m -layout SPUD -fs HFS+J
hdiutil attach "/tmp/${os_name}.cdr.dmg" -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source "/Applications/Install macOS ${os_name}.app/Contents/SharedSupport/BaseSystem.dmg" -target /Volumes/install_build -noprompt -noverify -erase
hdiutil detach "/Volumes/OS X Base System"
hdiutil convert "/tmp/${os_name}.cdr.dmg" -format UDTO -o "/tmp/${os_name}.iso"
mv "/tmp/${os_name}.iso.cdr" ~/Desktop/"${os_name}.iso"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment