Skip to content

Instantly share code, notes, and snippets.

@fcicq
Last active September 15, 2015 13:23
Show Gist options
  • Save fcicq/ee0733a475fa2192eb1b to your computer and use it in GitHub Desktop.
Save fcicq/ee0733a475fa2192eb1b to your computer and use it in GitHub Desktop.
# ==============================================================
# 10.10 How to make an ISO from the Install.app
# ==============================================================
# Mount the installer image. It assumes that the installation app is called "Install OS X Yosemite.app"
# located in your "Applications" folder. If not, change the first command accordingly.
# you are expected to prepare /System/Library/Kernels/kernel at this stage
# kernel can be extracted from InstallESD.dmg/Packages/Essentials.pkg/System/Library/Kernels/kernel with Pacifist
PATH_TO_KERNEL=kernel
if [ ! -e ${PATH_TO_KERNEL} ]; then
echo Please prepare the kernel first for a chameleon boot,
echo or just remove the check for a genuine Apple PC only ISO.
exit
fi
hdiutil attach /Applications/Install\ OS\ X\ Yosemite.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/Yosemite
# Increase the sparse bundle capacity to 8GB to accommodate the packages
hdiutil resize -size 8g /tmp/Yosemite.sparseimage
# Mount the sparse bundle for package addition
hdiutil attach /tmp/Yosemite.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/
cp -rp /Volumes/install_app/BaseSystem.* /Volumes/install_build/
if [ -e $PATH_TO_KERNEL ]; then
mkdir -p /Volumes/install_build/System/Library/Kernels
cp $PATH_TO_KERNEL /Volumes/install_build/System/Library/Kernels/kernel
fi
# 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/Yosemite.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Yosemite.sparseimage
# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite
# Remove the sparse bundle
rm /tmp/Yosemite.sparseimage
# Rename the ISO and move it to the desktop
mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment