garettmd
4/4/2018 - 6:49 PM

OS X: Create El Capitan ISO compatible with VirtualBox

OS X: Create El Capitan ISO compatible with VirtualBox

#!/usr/bin/env bash

# All credit goes to http://apple.stackexchange.com/a/211722, and thanks to Jesse Web 
# for posting the article at http://apple.stackexchange.com/questions/198737/install-el-capitan-in-virtual-box-for-testing-purposes

hdiutil attach "/Applications/Install OS X El Capitan.app/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint /Volumes/esd
hdiutil create -o elcapitan.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach elcapitan.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/iso
asr restore -source /Volumes/esd/BaseSystem.dmg -target /Volumes/iso -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/esd/Packages /Volumes/OS\ X\ Base\ System/System/Installation
cp -rp /Volumes/esd/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/
cp -rp /Volumes/esd/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/esd
hdiutil detach /Volumes/OS\ X\ Base\ System
hdiutil convert elcapitan.cdr.dmg -format UDTO -o elcapitan.iso
mv elcapitan.iso.cdr elcapitan.iso