Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rhimbo

macrumors member
Original poster
Jun 21, 2009
82
17
I tried searching the internet for comprehensive documentation on nvram. I'd like to know the full set of options that nvram recognizes and processes and what are the acceptable values for each one.

I can't find this anywhere. I don't believe "nvram -p" gives you this. From the man page and running the command, it appears that the "-p" option only "prints" the options that are currently set.
 
  • Like
Reactions: MacMan988

joevt

Contributor
Jun 21, 2012
6,665
4,078
I don't think anyone's going to document all the options. If you have a question about a specific set of options, then we can try to answer that.

Note that "nvram -p" only shows macOS nvram variables. There are many more that you can see with the dmpstore command in an EFI Shell. The nvram command can see some of those if you specify them by UUID and name. For example, the EFI BootOrder variable can be viewed using
nvram 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:BootOrder

The "-data" nvram variables are EFI (or UEFI) paths. Use gfxutil to view those.

I've attach a script to help dump some nvram variables. Load it temporarily using source gfxutil.sh. Then you can use the commands that are defined in the script like below:
Code:
source gfxutil.sh


nvram -p
efi-backup-boot-device-data    %02%01%0c%00%d0A%03%0a%00%00%00%00%01%01%06%00%02%1f%03%12%0a%00%02%00%00%00%00%00%04%01*%00%09%00%00%00%88%c84.%00%00%00%00%00%95%0b%1d%00%00%00%00%e1 wqC$>D%b2m%d8P%98%bc1%9e%02%02%04%03$%00%f7%fct%be|%0b%f3I%91G%01%f4%04.hB%e9HF%94%fdQ%87C%b5%8e%ad%0fg%c4?B%04%04%9a%00\%009%000%00F%000%00D%00B%00E%007%00-%00E%002%003%00F%00-%004%006%003%001%00-%009%009%007%00A%00-%000%005%008%005%00D%00A%002%004%00A%00C%00F%00D%00\%00S%00y%00s%00t%00e%00m%00\%00L%00i%00b%00r%00a%00r%00y%00\%00C%00o%00r%00e%00S%00e%00r%00v%00i%00c%00e%00s%00\%00b%00o%00o%00t%00.%00e%00f%00i%00%00%00%7f%ff%04%00
efi-backup-boot-device    <array><dict><key>IOMatch</key><dict><key>IOProviderClass</key><string>IOMedia</string><key>IOPropertyMatch</key><dict><key>UUID</key><string>944648E9-51FD-4387-B58E-AD0F67C43F42</string></dict></dict><key>BLLastBSDName</key><string>disk6s2</string></dict><dict><key>IOEFIDevicePathType</key><string>MediaFilePath</string><key>Path</key><string>\90F0DBE7-E23F-4631-997A-0585DA24ACFD\System\Library\CoreServices\boot.efi</string></dict></array>%00
boot-args    -v debug=0x144 -no_compat_check maxmem=63488 keepsyms=1
efi-boot-device    <array><dict><key>IOMatch</key><dict><key>IOProviderClass</key><string>IOMedia</string><key>IOPropertyMatch</key><dict><key>UUID</key><string>01A40057-B54C-4974-AF84-A70CD2E937FF</string></dict></dict><key>BLLastBSDName</key><string>disk1s12</string></dict><dict><key>IOEFIBootOption</key><string>maxmem=63488</string></dict></array>%00
bluetoothActiveControllerInfo    %06%82%ac%05%01%00%00%00 ]%00%1f%f3%b6%c2e
bluetoothInternalControllerInfo    %06%82%ac%05%00%00 ]%00%1f%f3%b6%c2e
prev-lang:kbd    en:0
SystemAudioVolumeDB    %80
fmm-computer-name    Joe%e2%80%98s Mac Pro
efi-boot-device-data    %02%01%0c%00%d0A%03%0a%00%00%00%00%01%01%06%00%02%1f%03%12%0a%00%02%00%00%00%00%00%04%01*%00%0c%00%00%00%00%8a%c6o%00%00%00%00%88%90%01%00%00%00%00%00W%00%a4%01L%b5tI%af%84%a7%0c%d2%e97%ff%02%02%7f%ff%04%00
csr-active-config    w%00%00%00
SystemAudioVolume    %80
EFIBluetoothDelay    %b8%0b
LocationServicesEnabled    %01


dumpallioregefipaths
/Root//chosen/boot-file-path = \E2964837-5836-464D-86E1-3B32F1CC771B\System\Library\CoreServices\/boot.efi
/Root//chosen/boot-device-path = PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(9,GPT,717720E1-2443-443E-B26D-D85098BC319E,0x2E34C888,0x1D0B9500)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E9484694FD518743B58EAD0F67C43F42)
/Root//options/efi-backup-boot-device-data = PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(9,GPT,717720E1-2443-443E-B26D-D85098BC319E,0x2E34C888,0x1D0B9500)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E9484694FD518743B58EAD0F67C43F42)/\90F0DBE7-E23F-4631-997A-0585DA24ACFD\System\Library\CoreServices\boot.efi
/Root//options/efi-boot-device-data = PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(12,GPT,01A40057-B54C-4974-AF84-A70CD2E937FF,0x6FC68A00,0x19088)
/Root/MacPro3,1/AppleACPIPlatformExpert/AppleEFIRuntime/AppleEFINVRAM/efi-backup-boot-device-data = PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(9,GPT,717720E1-2443-443E-B26D-D85098BC319E,0x2E34C888,0x1D0B9500)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E9484694FD518743B58EAD0F67C43F42)/\90F0DBE7-E23F-4631-997A-0585DA24ACFD\System\Library\CoreServices\boot.efi
/Root/MacPro3,1/AppleACPIPlatformExpert/AppleEFIRuntime/AppleEFINVRAM/efi-boot-device-data = PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(12,GPT,01A40057-B54C-4974-AF84-A70CD2E937FF,0x6FC68A00,0x19088)


nvramp efi-backup-boot-device-data | gfxutil
PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(9,GPT,717720E1-2443-443E-B26D-D85098BC319E,0x2E34C888,0x1D0B9500)/VenMedia(BE74FCF7-0B7C-49F3-9147-01F4042E6842,E9484694FD518743B58EAD0F67C43F42)/\90F0DBE7-E23F-4631-997A-0585DA24ACFD\System\Library\CoreServices\boot.efi


nvramp efi-boot-device-data | gfxutil
PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(12,GPT,01A40057-B54C-4974-AF84-A70CD2E937FF,0x6FC68A00,0x19088)


dumpallbootvars
BootOrder: Boot0080 Boot0000
Boot0000: 1, "ubuntu", "HD(1,GPT,19D44A4A-72CE-488C-869C-32776991515D,0x28,0x64000)/\EFI\ubuntu\shimx64.efi"
Boot0080: 1, "Mac OS X", "PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0x0,0x0)/HD(12,GPT,01A40057-B54C-4974-AF84-A70CD2E937FF,0x6FC68A00,0x19088)", "maxmem=63488"



getaaplpathprops > /tmp/AAPLPathProperties.bin
gfxutil -v -o xml -i bin /tmp/AAPLPathProperties.bin /tmp/AAPLPathProperties.plist > /tmp/AAPLPathPropertieslog.txt
plutil -p /tmp/AAPLPathProperties.plist
{
  "PciRoot(0x0)/Pci(0x5,0x0)/Pci(0x0,0x0)" => {
    "saved-config" => {length = 312, bytes = 0x0f084c04 69090000 07000000 0000000f ... 00000000 00000000 }
  }
}


echo 0x$(nvramp SystemAudioVolumeDB | xxd -p)
0x80


nvramp fmm-computer-name
Joe‘s Mac Pro


echo 0x$(nvramp SystemAudioVolume | xxd -p)
0x80


echo "obase=2;$((0x$(nvramp csr-active-config | xxd  -p -c1 | tail -r | tr -d '\n')))" | bc
1110111


echo $((0x$(nvramp EFIBluetoothDelay | xxd -p -c1 | tail -r | tr -d '\n')))
3000


echo $((0x$(nvramp LocationServicesEnabled | xxd -p)))
1

Edit: gfxutil.sh moved to https://gist.github.com/joevt/477fe842d16095c2bfd839e2ab4794ff
 
Last edited:

rhimbo

macrumors member
Original poster
Jun 21, 2009
82
17
Well, currently I don't have a specific question about a specific option. I'm just trying to learn what settings are available, which are recognized by the nvram command so that I learn the platform and know what's available.

Especially for something like this, it's better to read ahead of time than to just hack it.

I am trying to learn how to do things generally on macOS. It's certainly different from Solaris or Linux or <fill in your favorite flavor of Unix-like system>.....

I take it that Apple doesn't provide that documentation? I was hoping someone would know where to find Apple's documentation on this.

Thanks for the scripts. I'll take a look....
 

joevt

Contributor
Jun 21, 2012
6,665
4,078
Thankfully, there's not a lot in nvram that you need to deal with. There is some documentation in the man pages. There's also some source code at opensource.apple.com . There's some documentation at developer.apple.com. Mac developers (or at least Apple developers) hang out in the forums there. There's also lists.apple.com but many lists there are deprecated because of the new forums?

As for nvram variables:

There's the efi-boot nvram variables that are set by the Startup Disk preferences panel or the bless command (check the man page of that). They also affect the Boot#### variables. You can try those and see how they change the nvram variables (compare before and after a change).

On old Macs that boot Windows or Linux using legacy BIOS mode, there's a BootCampHD variable that points to a disk containing an MBR with boot code. In that case the efi-boot-device points to a EFI image that knows how to setup BIOS compatibility and boot the BootCampHD. For example, I have an old Mac Pro 2008 which can only safely boot Windows using legacy BIOS mode but I can boot Ubuntu with EFI because it's more forgiving or knows how to run ok on old Mac EFI.

boot-args is a catch all for many flags that can affect the kernel and kernel extensions or whatever.

I think the efi bootvar Boot#### can contain boot-args to be passed to boot.efi (my example shows "maxmem=63488" for Boot0080 - I haven't tested this). boot-args can also exist in a com.apple.Boot.plist file (man com.apple.Boot.plist) so that the boot-arg can survive an nvram reset. The best way to see a man page in macOS is to type the word in Terminal.app, right-click it, and select "Open man Page").

nvram variables also exist in the io registry at /Root//options/ (in the IODeviceTree plane). To view the IOService plane (where kexts are loaded), use ioreg -filw0. To view only the options node, use ioreg -fiw0 -p IODeviceTree -rn options . You can also use IORegistryExplorer.app from Xcode tools to view the IO registry.
I think a kernel extension can create properties in the options node to make nvram variables.

csr-active-config is a list of flags used by SIP. The SIP flags are listed at https://opensource.apple.com/source/xnu/xnu-6153.81.5/bsd/sys/csr.h.auto.html
(go to https://opensource.apple.com/source/xnu to make sure 6153.81.5 is the latest)
Use csrutil from Terminal.app running from an installer or recovery partition to modify SIP (google "how to disable sip" for more info).

EFI on Mac can setup device properties for specific devices. boot.efi will store these in a property named "device-properties" in the "efi" node of the IODeviceTree plane. These properties may affect the functioning of the kernel extension that matches the device. See the getdeviceprops command in my script. gfxutil can be used to display the contents. Device properties can also be saved to nvram and are combined by boot.efi into the "device-properties" property. See the getaaplpathprops command in my script.

Other properties in the IO registry can come from ACPI DSDT and SSDT. Use MaciASL.app to disassemble the ACPI tables. ACPI tables can be patched or replaced by a boot loader like OpenCore.

OpenCore is used to get macOS to run on PCs. To learn about Macs it may be interesting to know how OpenCore allows macOS to run on a PC. Learning how Linux runs on a Mac is also interesting.
 

Dayo

macrumors 68020
Dec 21, 2018
2,216
1,257
If you have a question about a specific set of options, then we can try to answer that.
I know I can get my GPU path with gfxutil -f display but wondering whether it gives two different PCIRoot paths if two GPUs are present. Any clues?
 

joevt

Contributor
Jun 21, 2012
6,665
4,078
I know I can get my GPU path with gfxutil -f display but wondering whether it gives two different PCIRoot paths if two GPUs are present. Any clues?
It will return multiple EFI device paths if there's more than one match.

Example: my MacPro3,1 has two ethernet controllers:
Code:
gfxutil -f ethernet
19:00.0 8086:1096 /PCI0@0/P0P9@9/P9P2@0/P2P5@2/LAN0@0 = PciRoot(0x0)/Pci(0x9,0x0)/Pci(0x0,0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)
19:00.1 8086:1096 /PCI0@0/P0P9@9/P9P2@0/P2P5@2/LAN1@0,1 = PciRoot(0x0)/Pci(0x9,0x0)/Pci(0x0,0x0)/Pci(0x2,0x0)/Pci(0x0,0x1)
 
  • Like
Reactions: Dayo

kocoman

macrumors 6502
Dec 26, 2007
309
38
can this script dump the thunderboltdrom or make a section for coreboot/tianocore for efi-properties for thunderboltdrom injection? thx
 

jarome

macrumors newbie
Jul 23, 2011
6
5
This is old, but I can use
sudo nvram "recovery-boot-mode=unused" && sudo reboot recovery
to boot into recovery mode without using the keyboard (which never works for me).
Is there a similar command that will boot me into the mode that lets me select the boot disk (so I can boot off a USB drive). The option key does not work for me either.
 

startergo

macrumors 601
Sep 20, 2018
4,792
2,193
This is old, but I can use
sudo nvram "recovery-boot-mode=unused" && sudo reboot recovery
to boot into recovery mode without using the keyboard (which never works for me).
Is there a similar command that will boot me into the mode that lets me select the boot disk (so I can boot off a USB drive). The option key does not work for me either.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.