Skip to content

Instantly share code, notes, and snippets.

@yyang
Created September 14, 2016 14:19
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 yyang/8d0e5d0ce45957a2b0218e7576f917b5 to your computer and use it in GitHub Desktop.
Save yyang/8d0e5d0ce45957a2b0218e7576f917b5 to your computer and use it in GitHub Desktop.
macOS Sierra spoiler for VMWare Workstation installation.
#!/bin/bash
# Mount the Installer image
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Create Sierra sparseimage of 7316mb with a Single Partition - Apple Partition Map
hdiutil create -o /tmp/Sierra -size 7316m -layout SPUD -fs HFS+J -type SPARSE
# Mount the Sierra sparseimage
hdiutil attach /tmp/Sierra.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
# Restore the Base System into the Sierra Blank sparseimage
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
# Remove Packages link and replace with actual files
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
# Copy Sierra installer dependencies
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
# Unmount the installer image
hdiutil detach /Volumes/install_app
# Unmount the Base System image
hdiutil detach /Volumes/OS\ X\ Base\ System/
# Convert the Sierra spareseimage image to ISO/CD master
hdiutil convert /tmp/Sierra.sparseimage -format UDTO -o /tmp/Sierra.iso
# Rename the Sierra ISO image and move it to the desktop
mv /tmp/Sierra.iso.cdr ~/Desktop/'Sierra 10.11.0.iso'
# Delete Sierra.sparseimage file
rm -f /tmp/Sierra.sparseimage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment