Figure Out Why Your Mac Won’t Sleep With This Terminal Tip

Have you ever been confused, and subsequently annoyed, that your Mac won’t go to sleep when you tell it to? There’s a way you can find out what’s keeping your Mac awake in Mac OS X 10.6 and later.

To start with, run the following command in your Terminal: “pmset -g assertions

In the first section of output, you’ll see the status of two kernal assertions (i.e. the assumptions the system is making about the state of your system) named “PreventSystemSleep” and “PreventUserIdleSystemSleep.” If the status for either of these is 1, then that means that the assumption is currently triggered and something is preventing your Mac from sleeping.

Below this, you’ll see a second section that lists the processes that own any enabled assertions. It will be listed by process ID (the number you see after “pid”) and by bundle ID (the text in parenthesis after the process ID). For instance, in the image above you see that a processes is preventing sleep — coreoudiod — because it’s processing iTunes music.

If the bundle ID isn’t familiar, you can enter “ps up <pid>” at the Terminal command line, or look in Activity Monitor, to find the name of the command associated with that process. If you discover an app, like iTunes, you can terminate it and then put your Mac to sleep. If the process is not an app that you meant to run and is something else instead, terminating it may make your system unstable, which might cause it to crash. So make sure you recognize the processes you are terminating before you do so. Otherwise, close them and put your Mac to sleep!

Source: Macworld
Image Credit: Sync Blog

Kaylie lives in Ottawa and got her first Mac in 2007 and is now a fan for life.