OSX: Create Bootable iso from Mavericks/Yosemite installer
!!! Execute all as root !!!
VERSION=”Mavericks”
or
VERSION=”Yosemite”
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ ${VERSION}.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/${VERSION}
# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/${VERSION}.sparseimage
# Mount the sparse bundle for package addition
hdiutil attach /tmp/${VERSION}.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
# Remove Package link and replace with actual files
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/
# Unmount the installer image
hdiutil detach /Volumes/install_app
# Unmount the sparse bundle
hdiutil detach /Volumes/install_build
# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/${VERSION}.sparseimage | tail -n 1 | awk ‘{ print $1 }’`b /tmp/${VERSION}.sparseimage
# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/${VERSION}.sparseimage -format UDTO -o /tmp/${VERSION}
# Remove the sparse bundle
rm /tmp/${VERSION}.sparseimage
# Rename the ISO and move it to the desktop
mv /tmp/${VERSION}.cdr ~/Desktop/${VERSION}.iso
Leave a comment