I've done some searching online without luck, hoping that one of you mac virtuosos might know the answer. Is there a command that will reboot a Mac into recovery mode? (I know I can do Command + R but Im looking for a terminal command to do this.)
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 Recovery on the next boot, and then reboots the machine.
When done in Recovery mode, run the following from the Terminal in Recovery mode:
sudo 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.
-
That worked,
sudo nvram recovery-boot-mode=unused
andsudo reboot
does indeed boot to recovery. I did not runsudo nvram -d recovery-boot-mode
to reset nvram, I just simply rebooted the machine and it put me back into the OS. – as134_user3693277 Aug 23 at 17:08
nvram
command and how to set theboot-args
values with that. I'm not turning this into an answer, because testing it scares me (and I always test my answers, if at all possible). – Kusalananda Aug 22 at 21:05nvram
shouldn't damage the file system, but it might render the Mac unbootable. But as long as you don't have a firmware password set, you can reset the nvram by holding Command-Option-P-R as the Mac starts up. If you do have a firmware password set... please turn it off before experimenting. Oh, and the newer Macs with T2 security chips may be weird; I haven't experimented with them yet, so I don't know what might go wrong... If you have one, maybe you should play it safe. – Gordon Davisson Aug 23 at 1:42