MacOS/Installmedia

From Segfault
Jump to: navigation, search

El Capitan

createinstallmedia

How to create a bootable MacOS X 10.11 USB installer[1].

  1. Download El Capitan in the App Store, but don't install it
  2. After the download is complete, the new MacOS X version should be located in the /Applications directory
  3. Create the USB install media
$ sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia \
    --volume /Volumes/USB --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app --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 a MacBook Pro (2009) this took 20 minutes to complete.

$ sudo file -Ls /dev/rdisk2*
/dev/rdisk2:   x86 boot sector; partition 1: ID=0xaf, active, starthead 254, startsector 2, 15794174 sectors, code offset 0x0
/dev/rdisk2s1: Macintosh HFS Extended version 4 data (mounted) last mounted by: 'HFSJ', created: [...]

Boot the machine and hold the Option key[2] and select the USB drive to boot from and the installation should begin.

Mavericks

While one might be able to download the installation image from the "App Store", it cannot be used right away as a boot medium. Here's two ways how to create one:

createinstallmedia

While still in MacOS X, createinstallmedia[3] can do all this:

$ sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia \
     --volume /Volumes/usbdrive \
     --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

Erasing Disk: 0%... 10%... 20%... 100%...
Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.

hdiutil

We can build an boot disk with hdiutil too. Note: the resulting disk image seems to forget to create a recovery partition[4] during the installation! Let's describe it anyway, for the sake of completeness:

Verify the downloaded image:

SHA1: e804dea01e38f8cd28d6c1b1697487e50898dbe7  Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg
 MD5: f222952400db8535c03697c3293e168e          Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg

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:

hdiutil convert /Volumes/install_esd/BaseSystem.dmg -format UDSP -o /tmp/Mavericks

Grow the sparse bundle to make room for additional packages:

hdiutil resize -size 8g /tmp/Mavericks.sparseimage

Mount the resized sparse bundle:

hdiutil attach /tmp/Mavericks.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/Mavericks.sparseimage | tail -n 1 | awk '{ print $1 }'`b
hdiutil resize -size $SIZE /tmp/Mavericks.sparseimage

Convert to a CD image:

hdiutil convert /tmp/Mavericks.sparseimage -format UDTO -o /tmp/Mavericks

Remove sparse image, rename ISO:

rm /tmp/Mavericks.sparseimage
mv /tmp/Mavericks.cdr ~/Mavericks.iso

Links

References