Can I initiate a MacOS restart to Recovery mode solely from the command line?
I've done some searching online without luck, hoping that one of you Mac virtuosos might know the answer. On Intel Macs, I know I can hold Command + R but I'm looking for a terminal command to initiate this without keys being pressed.
Is there a command that will reboot a Mac into recovery mode?
Solution 1:
You can do that using the following command:
sudo nvram "recovery-boot-mode=unused"
sudo reboot
This sets a firmware variable in nvram indicating that you want to start in Recovery mode on the next boot, and then reboots the machine.
When done in Recovery mode, run the following from the Terminal in Recovery mode:
nvram -d recovery-boot-mode
This deletes the firmware variable so that the next boot is a normal boot.
If Recovery boot fails and you cannot progress, you could also remove the firmware variable by holding down the keys Command, Option, P, and R during boot. This resets the nvram and thus the firmware variable.
Solution 2:
None of the above solutions worked for me in Big Sur. But this one did.
Internet:
sudo nvram internet-recovery-mode=RecoveryModeNetwork
or Disk:
sudo nvram internet-recovery-mode=RecoveryModeDisk
when done
sudo nvram -d internet-recovery-mode
Solution 3:
With Big Sur and the Intel / M1 chip changes, I'm using a tool to manage this for me.
- https://twocanoes.com/booting-to-macos-recovery-and-diagnostics-mode/
This is open source, so you can look at how it works under the hood for each iteration of the OS and various nvram
settings.
Not all invocations work on all OS and hardware: For example, on my Mac Pro 2013 (the shiny black cylinder Mac Pro) the only command that worked for me was
sudo nvram internet-recovery-mode=RecoveryModeDisk
sudo reboot
Now that Big Sur and the Apple Silicon M1-based Macs have shipped - we can retest this on the 2020 hardware.
- https://mrmacintosh.com/boot-to-internet-recovery-recovery-partition-or-diagnostics-from-macos/
- https://support.apple.com/en-us/HT201255