Skip to content

Instantly share code, notes, and snippets.

@skube
Created October 20, 2018 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skube/df590919b1206aa31aa650ad5ef56854 to your computer and use it in GitHub Desktop.
Save skube/df590919b1206aa31aa650ad5ef56854 to your computer and use it in GitHub Desktop.
Bootable macOS ISO from installer DMG
#!/bin/bash
#
# Bash script to create a Bootable ISO from macOS Install Image from Mac App Store
# Version: macOS v10.12 (Sierra)
#
# INSTRUCTIONS:
# - save as a text file
# - open terminal
# - on command line, enter: sh bootable_macos_sierra.sh
#
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment