nvram - macOS


Overview

nvram manages non-volatile RAM (NVRAM) settings on macOS, allowing the modification and retrieval of firmware settings, hardware configurations, and other persistent data.

Syntax

nvram [-v] [-p] [-f filename] [-d] [-delete variable] variable=value

Options/Flags

  • -v: Verbose output, displaying all NVRAM variables and their values.
  • -p: Print the value of the specified variable without modifying NVRAM.
  • -f filename: Read or write NVRAM variables from/to a file.
  • -d: Delete the specified variable from NVRAM.
  • -delete variable: Delete the specified variable from NVRAM.

Examples

Read the value of the “boot-args” variable:

nvram -p boot-args

Write the value “1” to the “nvda_drv” variable:

sudo nvram nvda_drv=1

Delete the “boot-args” variable:

sudo nvram -d boot-args

Import NVRAM variables from a file:

sudo nvram -f /path/to/nvram_variables.txt

Common Issues

  • Permission denied: Ensure you have administrator privileges to modify NVRAM settings. Use sudo to elevate permissions.
  • Variable not found: The specified variable may not exist in NVRAM. Double-check the variable name.

Integration

  • nvram can be used in shell scripts to automate the management of NVRAM settings.
  • It can be combined with the system_profiler command to retrieve hardware configuration information stored in NVRAM.
  • efibootmgr: Manages EFI boot entries.
  • smbios: Displays System Management BIOS (SMBIOS) information.
  • spctl: Controls the loading of kernel extensions and other code.