Skip to content

Instantly share code, notes, and snippets.

@davidjb
Created December 21, 2016 08:21
Show Gist options
  • Save davidjb/48204e370810407d6faeba48f1f414f1 to your computer and use it in GitHub Desktop.
Save davidjb/48204e370810407d6faeba48f1f414f1 to your computer and use it in GitHub Desktop.
Create macOS Sierra Recovery Partition Without Reinstalling
TARGET="/Volumes/Macintosh HD" # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install\ macOS\ Sierra.app" # Path to your macOS installer
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg
hdiutil mount ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate
hdiutil mount "$MACOS_INSTALLER/Contents/SharedSupport/InstallESD.dmg"
/tmp/recoveryupdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition "$TARGET" "/Volumes/OS X Install ESD/BaseSystem.dmg" 0 0 "/Volumes/OS X Install ESD/BaseSystem.chunklist"
hdiutil eject "/Volumes/Mac OS X Lion Recovery HD Update"/
hdiutil eject "/Volumes/OS X Install ESD"/
@tkorz888
Copy link

tkorz888 commented Feb 8, 2017

謝謝 正需要

@robhrt7
Copy link

robhrt7 commented May 4, 2017

Note: this should be ran from other computer agains the target, or from external disk boot. Read article https://davidjb.com/blog/2016/12/creating-a-macos-recovery-partition-without-reinstalling-osx-or-re-running-your-installer/

@tinyapps
Copy link

As Axile mentioned in the blog post referenced by operatino above, the backslashes need to be removed from the MACOS_INSTALLER path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment