Find out what's keeping your Mac awake

Have you ever been annoyed to find that your Mac wont go to sleep when you tell it to? Reader wjv found that, in Mac OS X 10.6 and later, theres a simple way of finding out whats keeping your Mac awake. To do so, run the following command in your Terminal: pmset -g assertions .

In the first section of output, youll 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, heres 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, youll 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: "'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep"

This second section lists the processes which own any enabled assertions, by process ID (the number after pid) and bundle ID (the text in parentheses after that). For example, above, two processes are preventing sleep: iTunes (because Im currently listening to music) and coreoudiod (probably because its processing iTunes music).

If the bundle ID doesnt ring a bell, 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 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 crashwhich would be a bit like sleeping, but not as nice.

This story, "Find out what's keeping your Mac awake" was originally published by Macworld.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon