Create a gist now

Instantly share code, notes, and snippets.

Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
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
@dispera
dispera commented Nov 29, 2016

Nice, thanks!

I suggest to add a line to remove a leftover file:
rm /tmp/Sierra.cdr.dmg

It could be after line 18 :)

@defender4github

o yea thank you, i have discovered the answer, but that s weird because, i dont have mac system to implement the bash code. hmm, is there any other method round this?

@jbrydges01

Thanks! this was a huge help

@chqiwang

Thank you! It helps me a lot!

@leomoon
leomoon commented Jan 3, 2017

THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment