#!/bin/sh | |
# Set the macOS installer path as a variable | |
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")" | |
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport" | |
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 http://swcdn.apple.com/content/downloads/42/58/091-94330/mm8vnigq4ulozt9iqhgcl9hp8m7iygsqbl/macOSUpd10.13.6.RecoveryHDUpdate.pkg --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 | |
else | |
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 | |
fi | |
echo "Finished creating Recovery HD" |
This comment has been minimized.
This comment has been minimized.
At what point is it expected that this script is running? i.e. when does a system have the OS installer still available in /Applications ? |
This comment has been minimized.
This comment has been minimized.
Same problem as @StevenKSanford. |
This comment has been minimized.
This comment has been minimized.
@StevenKSanford @gustavolessa23 you can copy dm util from 10.13.6 pkg and use it on mojave |
This comment has been minimized.
This comment has been minimized.
I assume this one is not going to work for Mojave 10.14.4? |
This comment has been minimized.
This comment has been minimized.
About to give this a shot. |
This comment has been minimized.
This comment has been minimized.
How did it go? Did it work for 10.14.5? I updated my MacPro trash-can hard drive, and i had to clone the new harddrive and i want to update the recovery partition. I'll try this myself and fork the script if it works. |
This comment has been minimized.
This comment has been minimized.
Not working for me. I'm on 10.14.5 too, after a taste of Catalina. I can't enter recovery mode since the downgrade. \sad |
This comment has been minimized.
This comment has been minimized.
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 Mojave.app 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: https://support.apple.com/en-us/HT208969 . 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. |
This comment has been minimized.
This comment has been minimized.
Awesome, after some try, and figure out that i haven't the installer in /Applications, this works well :) For better understanding, you should make some errors echo. Like "You don't got any installer". "You don't have internet connexion". ;) Thanks for you job ! |
This comment has been minimized.
This comment has been minimized.
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 "recovery.sh" and "sudo: recovery.sh", I get a "sudo: recovery.sh: 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 recovery.sh remains as just "Install macOS" or should I change that to "Install macOS Mojave"? |
This comment has been minimized.
This comment has been minimized.
This script didn't work for me on 10.14.6, this did however: |
This comment has been minimized.
This comment has been minimized.
do not use a colon between the sudo and the recovery.sh |
This comment has been minimized.
This comment has been minimized.
my Disk recovery disappeared (or you can see, shrank to only 20kb? not working anymore) /dev/disk5 (synthesized): |
This comment has been minimized.
This comment has been minimized.
The location for the 10.13.6 recovery package is (as best I can tell) currently http://swcdn.apple.com/content/downloads/63/02/061-90748-A_MQ4MTMMXYW/jtw6sxlorttnetfsu9wpu0rqubsa55bskp/SecUpd2020-002HighSierra.RecoveryHDUpdate.pkg |
This comment has been minimized.
This comment has been minimized.
Thanks a lot @jonathantneal and @toonetown! Worked perfectly for 10.14.6. Just changed |
This comment has been minimized.
This comment has been minimized.
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 |
This comment has been minimized.
This comment has been minimized.
@au10tic set the |
This comment has been minimized.
This comment has been minimized.
@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.
|
This comment has been minimized.
This comment has been minimized.
If you execute the code below you'll see your boot volume name. So maybe replace line 9 with:
But I'm very sceptical it will work... |
This comment has been minimized.
Thanks for sharing this! Had no issues with it..