How to View & Clear the Mac NVRAM Contents from Terminal in OS X
Advanced Mac users may find it necessary to view or directly manipulate firmware variables found within NVRAM on the computer. Typically the NVRAM contains specific system data about things like the system audio level, startup disk details, an active user name, screen backlighting and resolution, and other technical details. While most users have no business interacting with NVRAM, there are times when manually viewing and clearing out NVRAM variables can be beneficial for troubleshooting purposes.
With the help of a command line tool in OS X, Mac users can directly read and adjust firmware in OS X without having to reboot the Mac and performing a general NVRAM reset.
This probably goes without saying, but aside from listing the nvram contents, users should absolutely not delete or clear nvram variables if they don’t know exactly what they’re doing and why.
To get started, launch the Terminal, found in /Applications/Utilities/ and issue the following commands, depending on your desired objective:
How to View All NVRAM Contents on Current Mac
Issue the following command to print out all current NVRAM contents:
This will display the output in XML format, which is much more readable than the default format, which is read with the -p flag:
If you don’t specify -x flag, you’ll likely see a lot of gibberish, XML, and perhaps some plain text mixed in that is easily readable, but for the most part this data is only going to be relevant to advanced Mac users for troubleshooting purposes.
An example of nvram -p output may look like the following:
$ nvram -p
Again, this will be meaningless data to most users but advanced Mac users can find helpful details in the NVRAM if they know what to look for.
How to Clear All NVRAM from the Command Line in Mac OS X
The next most useful trick is to be able to clear out NVRAM with the same command string. To delete all nvram variables just use the following syntax:
For changes to take effect, you must reboot the Mac, thus unless you’re doing something else you may want to just initiate a reboot from the command line while you’re there.
Deleting Specific NVRAM Variables on Mac OS X
To be more specific, you can also target a set nvram variable for removal with the -d flag:
nvram -d (variable key name goes here)
For example, to clear the system audio setting from nvram:
nvram -d SystemAudioVolume
Going Further with nvram Modifications
The nvram command has other uses as well for advanced users, from settings like disabling the startup boot chime sound on a Mac to always booting into verbose mode in OS X or even enabling safe boot mode from the terminal for remote management or a headless/keyboardless Mac. For those interested in learning more about this powerful command, the man page for nvram is quite helpful, as is the basic –help flag to show other syntax options:
% nvram --help
nvram: (usage: no such option as --)
nvram [-x] [-p] [-f filename] [-d name] [-c] name[=value] ...
-x use XML format for printing or reading variables
(must appear before -p or -f)
-p print all firmware variables
-f set firmware variables from a text file
-d delete the named variable
-c delete all variables
name=value set named variable
name print variable
Note that arguments and options are executed in order.
Whether or not you find this necessary or easy really depends on your skill level and your needs. Many advanced Mac users know they can also reset the PRAM / NVRAM on boot with a key sequence, which can be helpful in troubleshooting some particular issues as well, and that approach removes everything from NVRAM similar to the -c flag during an actual reboot, which is perhaps easier for many users to remember. This is particularly valuable for working with remote machines connected through SSH or found elsewhere on the network, where it would be impossible to manually reset NVRAM with a keyboard shortcut sequence.
Another common example where clearing nvram can be beneficial for troubleshooting purposes is when the Mac App Store loads a blank display that won’t populate with any content or store data. For whatever reason, the nvram -c flag and rebooting almost always resolves that issue alone.