I have a late 2011 Macbook pro, and lately it hasn't been sleeping properly. If I close the lid for less than a minute and reopen it, it doesn't go to sleep while the lid is closed. The screen is still displayed immediately after reopening. Also, a few seconds after I open the machine, it will go to sleep on it's own. I have had the software checked and that doesn't seem to be the problem. What could be causing this and how do I get it fixed? It is still under warranty.
If there is a process that is preventing sleep (rather than a bug in the sleep implementation), you can use "pmset -g" in a terminal window to list the process that is doing that. This is covered over on superuser.
Here is an an example on my system. First, with nothing preventing sleep:
$ pmset -g assertions | egrep '(PreventUserIdleSystemSleep|PreventUserIdleDisplaySleep)' PreventUserIdleDisplaySleep 0 PreventUserIdleSystemSleep 0 $
Then I start music in iTunes:
$ pmset -g assertions | egrep '(PreventUserIdleSystemSleep|PreventUserIdleDisplaySleep)' PreventUserIdleDisplaySleep 0 PreventUserIdleSystemSleep 1 pid 264: [0x0000012c00000108] PreventUserIdleSystemSleep named: "com.apple.audio.'AppleHDAEngineOutput:1B,0,1,2:0'.noidlesleep" pid 95390: [0x0000012c0001749e] PreventUserIdleSystemSleep named: "Nameless (via IOPMAssertionCreate)"
How long does it take to get to sleep on its own if you leave it?
I'd suggest looking at the log entries in the Console.app to see what's happening when it tries to go to sleep.
A few things that I've encountered that can make a Mac slow to sleep:
- Nearly full hard disk (can make it slow to write out the hibernation data)
- Misbehving drivers (like, oh, I don't know, VMWare's virtual networking) that don't go to sleep quickly.
Aside from looking at the console for hints and checking your free disk space, this is the sort of thing where doing an SMC reset might actually be applicable.