Modifying the Energy Saver “Turn display off after” preferences in Yosemite using the terminal


What’s the problem?

I’m shocked at how little straightforward documentation there is regarding where the Energy Saver settings (from System Preferences) are stored or how to modify them using the terminal.

Where are the settings stored?

Using opensnoop, I was able to track down that Energy Saver modifies this file:

/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

The main slider in Yosemite is labeled Turn display off after: and has one slider for Battery and another for Power Adapter.

If you want to read how that’s stored in /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist via terminal, there are two commands you can use:

defaults read /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
(which will be labeled as “Display Sleep Timer” (the value 0 is for Never—otherwise, it’s straight numeric by minutes) or
pmset -g custom
(which will be labeled as displaysleep).

How do you change the settings?

To modify it for all power settings (according to the man page for pmset, there are separate parameters for a wall charger versus a UPS, so it’s easier to modify for all and then just modify battery afterwards), you’d enter this command into the terminal:

sudo pmset -a displaysleep 180
(for three hours, as an example) and then enter this command into the terminal:
sudo pmset -b displaysleep 25
(for 25 minutes, as an example) to modify just the battery settings.

If you look at /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist or the output of pmset -g custom, you’ll see your changes take immediately. If, however, you look at Energy Saver through System Preferences, you’ll see that the changes aren’t reflected immediately without a logout or a reboot.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.