nvram

Manipulate firmware variables.

Syntax
      nvram [ -p ] [ -f filename ] [ -d name ] [ -c ] [ name [= value ]] ...

Key
   -d name      Delete the named firmware variable.

   -f filename  Set firmware variables from a text file. The file  must  be  a  list  of  "name value"  statements.
                The  first space on each line is taken to be the separator between "name" and "value".
                If the last character of a line  is  \,  the  value extends to the next line.

   -x           Use  XML  format  for  reading  and writing variables.  This option must be used before
                the -p or -f options, since arguments are processed in order.

   -c           Delete all of the firmware variables.

   -p           Print all of the firmware variables.

The nvram command allows manipulation of firmware NVRAM variables. It can be used to get or set a variable. It can also be used to print all of the variables or set a list of variables from a file. Changes to NVRAM variables are only saved by clean restart or shutdown.

In principle, name can be any string. In practice, not all strings will be accepted. New World machines can create new variables as desired. Most variables require sudo administrator privilege to get or set.

The given value must match the data type required for name. Binary data can be set using the %xx notation, where xx is the hex value of the byte. The type for new variables is always binary data.

Changes to firmware settings can prevent a computer from booting. Backup your Mac and data with Time Machine or your backup method of choice and check the current value with -p before making any changes.

NVRAM Variables

aht-results         Contains details of the last run of the Apple Hardware Test.
backlight-level
bluetoothActiveControllerInfo
bluetoothInternalControllerInfo
boot-args           Multiple values can be set as a space-separated list   boot-args="item=0 item=1"
display-config
efi-apple-recovery
efi-boot-device
efi-boot-device-data
EFIBluetoothDelay   Time allowed for a wireless keyboard to connect during startup
fmm-computer-name
LocationServicesEnabled
prev-lang:kbd
SystemAudioVolume    Set this to %01 in pre 2017 Macs to silence the startup chime.
SystemAudioVolumeDB

To reset the NVRAM on any model of Mac

Shut down the Mac.

Power on the Mac then immediately press and hold down the keys: Command, Option, P and R.

Wait 20 seconds until the Mac has fully booted.

All the nvram settings will then revert to the default.

This will also reset the third-party kernel extension policy, if that has been previously changed from the default using spctl.

Examples

List all the variables curretly stored in your Mac’s NVRAM:

$ nvram -p

List all the variables curretly stored in your Mac’s NVRAM in XML format:

$ nvram -xp

List the current value (if any) of boot-args:

$ nvram -p | grep boot-args

Enable an external Apple SuperDrive on a Mac that already has a built-in optical drive.

$ sudo nvram boot-args="mbasd=1"

Set the boot-args variable to single user mode with the root device in hard drive partition 10:

$ sudo nvram boot-args="-s rd=*hd:10"

Create a new variable, ss64, containing a list of two C-strings that is terminated by a NUL:

$ sudo nvram ss64="String One%00String Two%00%00"

Delete the variable named ss64:

$ sudo nvram -d ss64

"True Ease in Writing comes from Art, not Chance, As those move easiest who have learned to dance" ~ Alexander Pope

Related macOS commands:

spctl - SecAssessment system policy security
macOS Keyboard Shortcuts
HT204063 - Reset NVRAM or PRAM on your Mac
HT201295 - How to reset the System Management Controller (SMC) on your Mac


Copyright © SS64.com 1999-2018
Some rights reserved