This could be useful on occasion:
Tried this. Didn’t work. Tried this:
sudo nvram recovery-boot-mode="unused"
Worked!
Thanks! That approach to quoting the argument makes more sense.
Very strange. The two commands should be equivalent.
In any typical UNIX shell (including the ones Apple includes), double-quotes serve primarily to avoid characters like spaces from being treated as argument delimiters. If there are no spaces (as is the case here), the application shouldn’t notice the differences.
As a quick test, I wrote up a C program to just dump command-line arguments:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("%d args\n", argc);
for (int i=0; i<argc; i++)
{
printf("argv[%d]=%s\n", i, argv[i]);
}
return 0;
}
I then ran it, passing in arguments quoted in different ways, and as expected, got the same results each time:
bash-3.2$ ./foo nvram "recovery-boot-mode=unused"
3 args
argv[0]=./foo
argv[1]=nvram
argv[2]=recovery-boot-mode=unused
bash-3.2$ ./foo nvram recovery-boot-mode="unused"
3 args
argv[0]=./foo
argv[1]=nvram
argv[2]=recovery-boot-mode=unused
bash-3.2$ ./foo nvram recovery-boot-mode=unused
3 args
argv[0]=./foo
argv[1]=nvram
argv[2]=recovery-boot-mode=unused
Same results using tcsh
and zsh
. So now, the more interesting question is how the nvram
command could tell the difference between those two variations. Unless you’re using a funky shell that uses the “=” character as an argument delimiter, there shouldn’t be any difference.
It works with no quotes, also.
Using Mojave, so… plain ol’ bash
For anybody allergic to Terminal, this is a more foolproof and faster solution (free from TwoCanoes):
Recovery Selector
and this video demonstration: https://www.youtube.com/watch?v=fS2s8TY1mrQ