13

I've looked around for answers and can't find something that works for me.

I have a unibody aluminum MacBook Pro and it just doesn't seem to want to sleep when I close the lid. The problem started after installing Lion.

When I close the lid, it appears to go to sleep (i.e. the Apple logo dims) but the status LED stays on and within 5 seconds, the Apple logo is back on. Lifting the screen very slightly reveals that the screen is on at this point.

I know that it's not sleeping and waking when I close the lid because syslog | grep -i "wake reason" does not show a wake entry for the time the laptop wakes up.

So far, I've tried PRAM reset, SMC reset, disabling all sharing and bluetooth options. It does sleep with the lid shut when booted in Safe Mode though. This leads me to believe that it's some kind of software or setting that's preventing sleep but I know no way of figuring this out.

Is there any way to fix this or find out what software is preventing sleep?

6 Answers 6

5

A lack of wake reason entries suggests your Mac is never fully sleeping. The sleep mechanism has started but never completes.

Use the following Terminal command to view a detailed log showing your Mac's power history:

pmset -g log

You will see a list of entries in form:

 * Domain: applicationresponse.slowresponse
 - Message: PMConnection AirPort configd plug-in com.apple.powermanagement.applicationresponse.slowresponse 1399 ms
 - Time: 13/03/2012 12:27:53 CET 
 - Signature: AirPort configd plug-in
 - UUID: AB482838-2D6E-0000-0000-14BF53E20000
 - Result: Noop
 - Response time (ms): 1399

Look out for applications that may be keeping your Mac awake and active. Applications and other processes can keep your Mac awake if they are providing a service, such as file sharing or remote access. However, processes should be forced asleep after 30 seconds on lid close.

The behaviour you are seeing suggests a kernel extension or IOKit problem. User level processes can not block sleep when instigated by the user.

Do you have any utilities installed that install kernel extensions (kext)? These might include screen recording or audio capture tools; utilities than need low level access to your Mac.

1
  • Your answer came closest. It turns out that I forgot Caffeine was installed and despite not having an icon in the menu bar like it should when running, it was still somehow affecting the sleep. Maybe it changed some system settings and didn't need to be running to cause trouble.
    – alexcoco
    Jan 11, 2013 at 3:44
2

It's worth repairing your permissions, if you haven't already done that. Permissions errors have caused a wide range of bizarre problems in the Lion upgrade.

It also might help to generate ideas if you can determine if the problem is system-wide or user-specific. Do that by creating a new, pristine user account and using that to see if the problem persists.

A genuine "clean install" of Lion is still a debated procedure, but some people who exhaust all other diagnostic possibilities have ended up going that route with good success. I hope your problem is more straightforward than that!

--

EDIT:

I gather that booting in Safe Mode solves the problem, but creating a new user doesn't. That strongly suggests the problem is something you're loading at startup. Good news is that this should be straightforward to fix.

Your experiments so far suggest that whatever is causing the problem is in your /Library directory, and not in your User folder. A manageably small list of things is disabled during a Safe Mode startup, including /System/Library/Extensions, /Library/StartupItems, and notably, any fonts outside of /System/Library/Fonts. Your problem must be something in one of these locations.

I have a funny feeling that you may have a corrupted font, since this is a common problem that manifests in odd ways. You could try the troubleshooting strategies described here, which essentially consist of validating the fonts using the Font Book utility (included with Mac OS X), clearing out the font cache, and removing any duplicates.

If fonts aren't the problem, this earlier discussion has good information about how to go about disabling errant startup extensions and login items. It's a matter of taking everything suspicious out, and adding things back bit-by-bit until you find your culprit.

I think you're close to the solution, please do let us know when you've cracked it.

3
  • Thanks, I'll try repairing permissions and creating a new user, hadn't thought of that. I'll let you know how it goes.
    – alexcoco
    Mar 5, 2012 at 16:37
  • I've created a new account and the same thing seems to happen though it seems to be okay in Safe Mode. Any clue as to what may or may not be different in Safe Mode?
    – alexcoco
    Mar 12, 2012 at 19:43
  • Very interesting! I'll take a look at these things and get back to you!
    – alexcoco
    Mar 14, 2012 at 14:47
2

Run the following command:

pmset -g assertions

and list all system-wide assertions preventing your system sleep along with their processes.

Whenever processes override any system power settings, pmset will list those processes and their power assertions in -g and -g assertions.

Normally when nothing is stopping macOS from going to sleep, you should have all 0. If you have 1 instead of 0 somewhere, the line could explain the reason of it.

Source: Display Sleep not working.

You can also check by the following command:

pmset -g | grep -w sleep

For example:

Idle sleep preventers: IODisplayWrangler

If you found a specific reason why the sleep isn't working, and still didn't help, please google or ask a new question with output specific details. Or simply restart your computer and see if that helps.



Troubleshooting

  • Check for any processes appearing in system-wide and kernel assertions via pmset -g assertions and kill or restart one which you think may be the cause of the issue.
  • Disable WiFi or any other network which may appear in the kernel assertions list.

    $ pmset -g assertions
    // ...
    Listed by owning process:
       pid 343(Google Chrome): [0x0000003600018115] 05:02:36 NoIdleSleepAssertion named: "WebRTC has active PeerConnections" 
    // ...
    Kernel Assertions: 0x100=MAGICWAKE
       id=501  level=255 0x100=MAGICWAKE mod=01/01/1970, 01:00 description=en0 owner=en0
    
  • Disconnect any external devices (USB, SD cards, bluetooth devices, etc.).

    $ pmset -g assertions
    Assertion status system-wide:
    // ...
       ExternalMedia                  1
    // ...
    Listed by owning process:
       pid 73(powerd): [0x0000000600088007] 05:03:24 ExternalMedia named: "com.apple.powermanagement.externalmediamounted" 
    // ...
    
  • Run the assertion logs by: pmset -g assertionslog, close the lid and read the logs.

  • If you expect hibernation instead of standard sleep mode, use pmset to verify hibernatemode, by default it should be set to 3:

    pmset -g | grep -w hibernatemode
    

    Otherwise set to 3 (you can also consider 25):

    sudo pmset -a hibernatemode 3
    

    See: man pmset and for further details.

    Warning: We do not recommend modifying hibernation settings. Any changes you make are not supported. If you choose to do so anyway, we recommend using one of these three settings. For your sake and mine, please don't use anything other 0, 3, or 25.

    hibernatemode = 0 (binary 0000) by default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

    hibernatemode = 3 (binary 0011) by default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

    hibernatemode = 25 (binary 0001 1001) is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

  • To check the current state of your display (below 4 means it's already in a sleep mode):

    pmset -g powerstate IODisplayWrangler
    
  • To put displays to sleep from the command-line, run:

    pmset displaysleepnow
    # or:
    osascript -e 'tell app "System Events" to sleep'
    

    To wake up a display:

    caffeinate -u -t 1
    

See also: pmset - Sample usage, How to Hibernate a Mac.

1

Have you tried this fix from the Apple forum. The uses fixed the issue by uninstalling a printer driver which he found out to be causing the issue.

You might also try disabling the "Wake for Network Access" option

4
  • I think I read about that printer driver at some point but I haven't tried uninstalling any. I'll give it a try. I believe I have also already disabled the wake for network access option but I'll double check anyway, thanks.
    – alexcoco
    Mar 5, 2012 at 17:26
  • I'd also like to mention again that it does sleep when booted in safe mode. If the printer driver was causing this but isn't booted in safe mode (which I would think is likely) then it may be the problem.
    – alexcoco
    Mar 5, 2012 at 17:31
  • Also, from what I've read some people have had problems when they had a certain VMWare product installed - so it seems even with the network access option disabled, some programs can still wake the computer. Best of luck!
    – OrangeBox
    Mar 6, 2012 at 0:10
  • I tried running the pmset -g assertions command like it says in that post but all I get is a list of things with 0 at the end except for one item that has EnableIdleSleep 1. I don't know how to interpret this but it doesn't look like a bad thing to me.
    – alexcoco
    Mar 12, 2012 at 19:46
0

Here's a way I've managed to rectify the wakeup/sleep issue with my MBP (early 09)

It never restarted when I reopened my lid.

Only occurred when waking up from sleep initiated by lid close.

Workaround I used was to switch off Automatically adjust brightness (Systems Preferences -> Displays). Hasn't re-occurred since – try that and see how you go.

1
  • My problem is the opposite. It wakes from sleep when the lid is opened if you sleep it but will not sleep if the lid is just closed. Have you read my question?
    – alexcoco
    Mar 9, 2012 at 16:23
0

I had this problem for a very long time.

You need to go to:  > System Preferences > Sharing

Then you need to TURN OFF Web sharing, Internet Sharing and Screen Sharing.

If these don't work, try turning off other sharing options.

1
  • I have no sharing options enabled. So far, I've tried PRAM reset, SMC reset, disabling all sharing and bluetooth options.
    – alexcoco
    Mar 5, 2012 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .