Tuesday, November 3, 2015

Create a bootable El Capitan image

There are numerous resources that are explaining how to create a bootable ISO image to install El Capitan on Virtual Box. However, it appears that they are missing one step that for me resulted in error during the installation. Here is the full list of commands. First, download the El Capitan Installation App and do the following:

hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/ElCapitan -size 8192m -layout SPUD -fs HFS+J -type SPARSE
hdiutil attach /tmp/ElCapitan.sparseimage -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 /Volumes/install_app/BaseSystem.* /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/install_app/
hdiutil resize -size `hdiutil resize -limits /tmp/ElCapitan.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/ElCapitan.sparseimage
hdiutil convert /tmp/ElCapitan.sparseimage -format UDTO -o /tmp/ElCapitan
mv /tmp/ElCapitan.cdr ~/Downloads/ElCapitan.iso
rm /tmp/ElCapitan.sparseimage