Skip to content

Instantly share code, notes, and snippets.

@RobertYim
Forked from davidjb/recovery.sh
Last active August 31, 2018 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertYim/87d60acfba0d3d5fa5c73bb0e17264e2 to your computer and use it in GitHub Desktop.
Save RobertYim/87d60acfba0d3d5fa5c73bb0e17264e2 to your computer and use it in GitHub Desktop.
Create macOS Sierra Recovery Partition Without Reinstalling
# Specify where to configure Recovery partition, or a disk image larger then 5GB
TARGET="/Volumes/Macintosh HD"
# Path to your macOS installer
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
# Download the Recovery Disk image, as of version 10.13.6
curl -C - -O http://swcdn.apple.com/content/downloads/29/03/091-94326/45lbgwa82gbgt7zbgeqlaurw2t9zxl8ku7/RecoveryHDMetaDmg.pkg
# Or from the installer
# $MACOS_INSTALLER/Contents/SharedSupport/BaseSystem.dmg
# $MACOS_INSTALLER/Contents/SharedSupport/BaseSystem.chuncklist
# Download the tool from older version DMG, it's removed from the 10.13.6 recovery image
curl -C - -O https://davidjb.com/files/dmtest
# Exract the pkg
pkgutil --expand /PathTo/RecoveryHDMetaDmg.pkg /tmp/recoverypkg
# Mount BaseSystem.dmg
hdiutil mount /tmp/recoverypkg/RecoveryHDMeta.dmg
# Create Recovery Partition
/PathTo/dmtest ensureRecoveryPartition "$TARGET" "/PathTo/BaseSystem.dmg" 0 0 "/PathTo/BaseSystem.chunklist"
# Eject disk images
hdiutil eject "/Volumes/Update"/ ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment