One night I put my MacBook Pro to sleep by closing the screen lid, only to notice the next morning that it had not actually gone into sleep mode. I could tell it had been idling because it did not feel cold to the touch. I verified my suspicion by checking the system log and my TimeMachine backups. The log showed the occasional activity, including the hourly TM backups.
I looked online and found a number of people with a similar problem. Most posts attributing it to OSX Lion, going back to a few weeks after Lion’s release. The first suggestions I found were the typical Mac troubleshooting steps: reboot, reset PRAM and SMC. But none of these worked, my Mac still would not sleep. It would even wake up when I closed the lid, after putting it to sleep manually.
I dug deeper into the support posts, until I came across a post that mentions the pmset command line tool. I was familiar with this tool because I had used it before to tweak some power management settings. The post suggests to use the -g assertions option to list the assertions that may prevent display or system sleep.
steveno@navi~ % pmset -g assertions 23/09/11 11:22:11 GMT+0 Assertion status system-wide: ChargeInhibit 0 PreventUserIdleDisplaySleep 0 PreventUserIdleSystemSleep 0 NoRealPowerSources_debug 0 CPUBoundAssertion 0 EnableIdleSleep 1 PreventSystemSleep 1 DisableInflow 0 DisableLowPowerBatteryWarnings 0 ExternalMedia 0 Listed by owning process: pid 25: [0x0000012c00000019] PreventSystemSleep named: "org.cups.cupsd"
The output of this command shows that the org.cups.cupsd process is preventing my system from going to sleep. cupsd is the printer system of OSX. I only have one printer installed that is really easy to re-add. So I decided to reset the printing system and see if it resolved my problem. To to this you navigate to the Print & Scan System Preferences dialog and option-click (or right-click) on the empty space in the Printers pane at the left hand side, and select Reset printer system. I re-added my printer at this time.
Invoking the pmset -g assertions command indicated that the cupsd assertions was gone.
Closing the lid put my MacBook to sleep, as before.