Have you ever been annoyed to find that your Mac won’t go to sleep when you tell it to? Reader
wjv found that, in Mac OS X 10.6 and later, there’s a simple way of finding out what’s keeping your Mac awake. To do so, run the following command in your Terminal: pmset -g assertions
.
In the first section of output, you’ll see the status of two kernel assertions (essentially, assumptions the system makes about the state of your system) named PreventSystemSleep
and PreventUserIdleSystemSleep
. An accompanying status of 1
for either of these means that it is currently triggered. For example, here’s what I see when I run that command on my Mac mini:
Assertion status system-wide: PreventUserIdleDisplaySleep 0 PreventSystemSleep 0 PreventUserIdleSystemSleep 1 ExternalMedia 1 DisableLowPowerBatteryWarnings 0 UserIsActive 0 ApplePushServiceTask 0 BackgroundTask 0
Below that, you’ll see something like this:
Listed by owning process: pid 9165(iTunes): [0x0000000100001192] 00:18:23 PreventUserIdleSystemSleep named: "Nameless (via IOPMAssertionCreate)" pid 175(coreaudiod): [0x0000000100001287] 00:12:39 NoIdleSleepAssertion named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep"
This second section lists the processes which own any enabled assertions, by process ID and bundle ID (the text in parentheses after that). For example, above, two processes are preventing sleep: iTunes (because I’m currently listening to music) and coreoudiod (probably because it’s processing iTunes’ music).
If the bundle ID doesn’t ring a bell, you can enter ps up
followed by the process ID at the Terminal command line, or look in Activity Monitor, to find the name of the command associated with that process. If you identify an app (such as iTunes in the example above), you can terminate it and put your Mac to sleep. If the process is something other than an app that you meant to run, terminating it may make your system unstable, which could cause it to crash—which would be a bit like sleeping, but not as nice.