Find why a Mac won't go to sleep

On the rare occasion that you go to put a Mac to sleep and, well, it won’t sleep, there’s an easy to way to find out what the holdup is. Though this is a somewhat technical approach, it should give a good starting point to anyone who’s confused as to why something like automatic sleep isn’t taking effect, and hopefully provide a quick resolution to the problem.

Determining the Cause of Sleep Prevention in Mac OS X with the Command Line

This works to determine both why a Mac won’t sleep and why a Mac display is not sleeping:

    • Launch Terminal from /Applications/Utilities/ and type the following command:

pmset -g assertions

  • Look through the reported assertion list for items with a “1” next to their name to find what’s keeping the Mac awake

For example, if you see something like the following:

$ pmset -g assertions
7/11/12 10:45:33 PM PDT
Assertion status system-wide:
PreventUserIdleDisplaySleep 0
CPUBoundAssertion 0
DisableInflow 0
ChargeInhibit 0
PreventSystemSleep 0
PreventUserIdleSystemSleep 1
NoIdleSleepAssertion 1
ExternalMedia 0
DisableLowPowerBatteryWarnings 0
EnableIdleSleep 1
NoRealPowerSources_debug 0
UserIsActive 0
ApplePushServiceTask 0

Listed by owning process:
pid 1827: [0x000000bb012c01f1] PreventUserIdleSystemSleep named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,1:0'.noidlesleep"

You’ll notice the “sleep when idle” feature is disabled, but what you really want to pay attention to is the lower portion of the list where the “Listed by owning process” report shows com.apple.audio as the reason that PreventUserIdleSystemSleep is enabled. Why is that? Because iTunes is running and playing music, meaning the computer isn’t idle.

If you’re having persistent problems with sleep and the above tip doesn’t give you any clue as to where to begin, sleep issues relating to hardware and power management quirks can often be fixed with an SMC reset. On the other side of the fence, another command line tip shows us how to find out why a Mac woke up from sleep. Sometimes the same thing preventing a Mac from sleeping is responsible from waking it up too, like Time Machine and schedule backups.

This is a handy tip from Lifehacker who also provides a similar tip for Windows computers. Don’t miss Apple’s article on the topic too for some additional help.