pmset is a command line utility that is used to manipulate the power management settings in Mac OS X. With this command, users can change a multitude of settings relating to their Mac’s response to certain power-related conditions, as well as troubleshoot power-related issues. This article will highlight a few of the more useful
pmset commands. For commands that have a zero at the end, simply replace the 0 with a 1 and re-execute the command to restore default behavior.
Set Your Portable Mac to Stay Asleep When the Lid is Opened
By default, Mac laptops will wake up if a sleeping machine’s lid is opened. You can prevent this behavior and choose to wake the Mac on your own terms by entering the following terminal command:
sudo pmset lidwake 0
Conversely, add the following flag to prevent the Mac from going to sleep when the lid is closed:
sudo pmset -a lidwake 0
Prevent Your Mac from Sleeping When the Power Button is Pressed
Have a Choice When Your Mac’s Power Button is Pressed
Pressing a Mac’s power button once will, by default, put the Mac to sleep (for Lion laptops, it brings up the power options menu). You can prevent this behavior with the following terminal command:
sudo pmset powerbutton 0
Prevent Your Portable Mac from Waking When the Power Source Changes
For Mac laptops, plugging or unplugging an AC Adapter can wake the computer. You can prevent this with the following terminal command:
sudo pmset acwake 0
Prevent Your Mac from Sleeping Due to Idleness
To keep your Mac awake even if you leave the computer idle, use the following command:
With this command running in the Terminal, the Mac will never fall asleep no matter how long the machine is left idle. Once you’re ready to change back to default behavior, press Ctrl-C.
Troubleshoot Sleep Issues
If your Mac isn’t sleeping like it should, you can run the following command to get information about all your power settings and track down the culprit that’s preventing your Mac from getting its beauty rest:
Track Down What’s Preventing Your Mac from Sleeping
This command will display in the Terminal window all the pmset arguments currently in use and their value. It’s helpful to have a guide to decipher these arguments and their value indicators, so check out Apple’s Manual Page for
In this case it’s showing process ID 173 as keeping the Mac from sleeping. Using the ps command as:
ps -ax | grep 173
This shows us that coreaudiod is the culprit. In this instance, iTunes was playing a song. Stopping playback released this “imposition” and the computer was back to being allowed to sleep.