Setting energy saver settings from the command line

You can use the pmset tool to set various energy saver settings. Do a man pmset in the Terminal to get a full listing of options for this utility. The following will turn off screen dimming, hard drive spin down, and machine sleeping while the machine is on the charger. You can replace -c with -b to edit the settings for the battery.

sudo pmset -c dim 0 spindown 0 sleep 0

If you want to turn these features on, just replace the zeroes with a number indicating the number of minutes. So to send the machine to sleep after 15 minutes of inactivity when it’s on the battery, use:

sudo pmset -b sleep 15

This command must be run as root, or by using sudo.

Leave a Reply

Your comment will not appear until the site owner approves it. Sometimes comments get automatically trashed by the spam filter, so if yours doesn't appear soon, feel free to submit it again.
To avoid your comment being flagged as spam, make sure you mention something about the above post (i.e., don't just leave a "Nice post!" comment).