Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create or update macOS Big Sur (or Catalina, or Mojave) Recovery Partition Without Reinstalling
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
# Set the target disk filesystem
FS_TYPE=$(diskutil info "$TARGET" | awk '$1 == "Type" { print $NF }')
echo "Target filesystem is \"${FS_TYPE}\""
# Download the APFS-compatible Recovery into /private/tmp (use 10.13.6, which also works with Mojave 10.14.x)
echo "Downloading macOSUpd10.13.6.RecoveryHDUpdate.pkg into /private/tmp"
curl --progress-bar -L -o /private/tmp/macOSUpd10.13.6.RecoveryHDUpdate.pkg
pkgutil --expand /private/tmp/macOSUpd10.13.6.RecoveryHDUpdate.pkg /private/tmp/recoveryupdate10.13.6
if [[ "${FS_TYPE}" == "apfs" ]]; then
echo "Running ensureRecoveryBooter for APFS target volume: $TARGET"
/private/tmp/recoveryupdate10.13.6/Scripts/Tools/dm ensureRecoveryBooter "$TARGET" -base "$MOUNT_POINT/BaseSystem.dmg" "$MOUNT_POINT/BaseSystem.chunklist" -diag "$MOUNT_POINT/AppleDiagnostics.dmg" "$MOUNT_POINT/AppleDiagnostics.chunklist" -diagmachineblacklist 0 -installbootfromtarget 0 -slurpappleboot 0 -delappleboot 0 -addkernelcoredump 0
echo "Running ensureRecoveryPartition for Non-APFS target volume: $TARGET"
/private/tmp/recoveryupdate10.13.6/Scripts/Tools/dm ensureRecoveryPartition "$TARGET" "$MOUNT_POINT/BaseSystem.dmg" "$MOUNT_POINT/BaseSystem.chunklist" "$MOUNT_POINT/AppleDiagnostics.dmg" "$MOUNT_POINT/AppleDiagnostics.chunklist" 0 0 0
echo "Finished creating Recovery HD"
Copy link

blindmanonacid commented Aug 13, 2019

This script didn't work for me on 10.14.6, this did however:
replying with this since this page seems to be the first hit on a google search to create a recovery partition for Mojave.

Copy link

danielshenry commented Nov 11, 2019

I'm not gonna lie...I am a copy/paste kind of terminal user :-/

with that said, after cd'ing into the folder with this script in it, using both "" and "sudo:", I get a "sudo: command not found" message...what am I doing wrong.

using iTerm2 3.3.0 on Mojave 10.14.6.

also, I do have the "Install macOS Mojave" app in my Applications folder, but the entry in remains as just "Install macOS" or should I change that to "Install macOS Mojave"?

do not use a colon between the sudo and the
so like this
sudo ./

Copy link

vacarogit commented Apr 8, 2020

Thanks for sharing this script. Because it references a 10.13.6 version of a Recovery HD file, I assumed it would install a 10.13.6 High Sierra recovery partition. I was surprised to discover that it actually uses whatever version of “Install macOS” .app is in your Applications folder. So in my case, my Mac Pro is running High Sierra, but I only had Install macOS in my Applications folder, so after running this script I ended up with a Mojave recovery partition.

If anyone else is looking specifically for a High Sierra recovery partition, and you can’t see Install macOS High Sierra in the App Store anymore, a direct link to High Sierra in the App Store is still available on this page: . In my case this App Store link only downloaded a small 22MB “stub” High Sierra installer which didn’t include the resources this script depends on. I gave up at that point and just used the stub installer to reinstall High Sierra and the recovery partition at the same time.

Also to note, on APFS disks the recovery partition no longer shows up in the boot menu on a Mac Pro 5,1 when you hold down the Option key while booting. APFS recovery partitions are a hidden volume within the disk’s APFS container, which isn’t listed in the boot menu like recovery partitions on HFS+ drives are. At least that’s true for my new NVMe drive. Nonetheless, booting into the recovery partition with Command+R worked great.

my Disk recovery disappeared (or you can see, shrank to only 20kb? not working anymore)
Can I use this script to recreate it? High Sierra 10.13.6 (no play to upgrade)

/dev/disk5 (synthesized):
0: APFS Container Scheme - +499.9 GB disk5
Physical Store disk2s2
1: APFS Volume MacOS 330.4 GB disk5s1
2: APFS Volume Preboot 19.3 MB disk5s2
3: APFS Volume Recovery 20.5 KB disk5s3 <---------
4: APFS Volume VM 1.1 GB disk5s4

Copy link

toonetown commented May 15, 2020

Copy link

aonez commented May 26, 2020

Thanks a lot @jonathantneal and @toonetown! Worked perfectly for 10.14.6. Just changed MACOS_INSTALLER to the path where I have the installer. Installing Catalina on a usb disk removed the recovery partition in my Mac mini's internal disk 🤷🏻‍♂️

Copy link

au10tic commented Jun 4, 2020

hi, how would i be able to create the recovery partition on a different Volume or disk? can anybody point me which lines to modify on the script

Copy link

aonez commented Jun 4, 2020

@au10tic set the TARGET to whatever disk you want, after line 9. I don’t know if it will work.

Copy link

au10tic commented Jun 5, 2020

@aonez where would I add the volume or disk that I need this on? I am trying to install this on disk1s1, mounted on /Volumes/CataRecovery any help on this, would be appreciated.

# Set the target disk as a variable

TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')

echo "Target disk is \"$TARGET\""

Copy link

aonez commented Jun 6, 2020

If you execute the code above you'll see your boot volume name. So maybe replace line 9 with:


But I'm very sceptical it will work...

Copy link

jonathantneal commented Oct 10, 2021

I have updated the URL, allowing the instructions to work again.

Copy link

everybodies commented Apr 26, 2022

Thank You, still works in 2022, Mojave 10.14 :)

Copy link

VinneyUK commented May 21, 2022

Hi this script appears run fine for me however, when I try and boot into the recovery partition (command R ) my machine still wants to boot into internet recovery :(

Any ideas - driving me bonkers this :(

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