Mac Insomnia? Use pmset To Discover The Reason

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

ALTHave 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:

pmset noidle

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:

pmset -g

Use pmset to see why your Mac isn't sleeping
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 pmset.

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.

Leave a Reply

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