I recently had an issue where one of my Mac’s would not go to sleep whatever you tried.
I had checked that the energy saver settings were set to go to sleep after a specific amount of time.
I had also checked all the open apps to make sure they didn’t have an option to force the machine not to go to sleep but alas still nothing.
It turns out there is a little known command that can be used to check why your Mac isn’t sleeping, in my case it turned out to be Spotify that was open (not playing music, but was telling the system it was).
The command itself is pmset -g assertions
When you run that command it will show up whether you have any assertions currently keeping your system from sleep, you are looking for anything with PreventUserIdleSystemSleep in it.
Davids-MacBook-Pro:~ david$ pmset -g assertions 23/08/2012 09:14:09 BST<br></br> Assertion status system-wide: PreventUserIdleDisplaySleep 0 PreventSystemSleep 0 PreventUserIdleSystemSleep 1 ExternalMedia 0 UserIsActive 0 ApplePushServiceTask 0 BackgroundTask 1 Listed by owning process: pid 120(coreaudiod): [0x0000000100000a19] 00:00:05 NoIdleSleepAssertion named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,1:0'.noidlesleep" pid 1444(iTunes): [0x0000000100000a18] 00:00:05 PreventUserIdleSystemSleep named: "Nameless (via IOPMAssertionCreate)" pid 4074(helpd): [0x0000000c0000094a] 00:33:59 BackgroundTask named: "com.apple.helpd.sdmbuilding"