MacOS/Installmedia
createinstallmedia
Download the macOS installer in the App Store but don't install it. After downloading, the new macOS version should be located in the /Applications directory and can be used to prepare a boot medium:[1][2]
$ sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia \ --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app \ --volume /Volumes/USB \ --nointeraction Erasing Disk: 0%... 10%... 20%... 30%...100%... Copying installer files to disk... Copy complete. Making disk bootable... Copying boot files... Copy complete. Done.
On an older MacBook Pro this took 20 minutes to complete. We now have:
$ sudo file -Ls /dev/rdisk2*
/dev/rdisk2: x86 boot sector; partition 1: ID=0xaf, active, starthead 254, startsector 2, 15794174 sectors, [...]
/dev/rdisk2s1: Macintosh HFS Extended version 4 data (mounted) last mounted by: 'HFSJ', created: [...]
Boot the machine and hold the Option key[3] and select the USB drive to boot from and the installation should begin.
hdiutil
We can build a boot disk with hdiutil too.
Note: the resulting disk image seems to forget to create a recovery partition[4] during the installation!
Mount the downloaded image:
hdiutil attach /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg \
-noverify -nobrowse -mountpoint /Volumes/install_esd
Convert the disk image to an sparse bundle:
VER=Mavericks
hdiutil convert /Volumes/install_esd/BaseSystem.dmg -format UDSP -o /tmp/${VER}
Grow the sparse bundle to make room for additional packages:
hdiutil resize -size 8g /tmp/${VER}.sparseimage
Mount the resized sparse bundle:
hdiutil attach /tmp/${VER}.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build
Remove symlink and copy actual files into the sparse bundle:
rm /Volumes/install_build/System/Installation/Packages cp -Rp /Volumes/install_esd/Packages /Volumes/install_build/System/Installation/
Unmount:
hdiutil detach /Volumes/install_esd hdiutil detach /Volumes/install_build
Resize to smalles size possible:
SIZE=`hdiutil resize -limits /tmp/${VER}.sparseimage | tail -n 1 | awk '{ print $1 }'`b hdiutil resize -size $SIZE /tmp/${VER}.sparseimage
Convert to a CD image:
hdiutil convert /tmp/${VER}.sparseimage -format UDTO -o /tmp/${VER}
Remove sparse image, rename ISO:
rm /tmp/${VER}.sparseimage mv /tmp/${VER}.cdr ~/${VER}.iso
Links
- How to create a bootable installer for macOS
- create-iso.sh - Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
- highsierra_bootable.sh - Create bootable ISO from HighSierra Installer
- Topic: Use Linux to install OSX from a DMG extracted to a partition - without a Mac DVD