MacBook won't sleep while charging

An ongoing problem: my MacBook Pro (i5, 2.4ghz, 15") won't sleep while charging. I close the lid, but I don't get the pulsing "sleep light", it just stays fully illuminated. If I listen closely, I can hear hard drive/fan activity.

This has been a problem since purchasing the machine in June of 2010. In retrospect, I should've taken it to the Genius Bar, but I was confident that an eventual system update would fix the problem... it hasn't. I even wiped the machine clean and reinstalled Lion (due to so me stability issues with the initial release of Lion), and that helped... for a while. Now the problem is back. I've even tried a different MacBook charger to no avail.

I've researched this issue before but none of the solutions that users suggested have worked (including various 'pmset' commands and also tinkering with EnergySaver settings). Any advice?


Solution 1:

You may want to look into the sharing options as well as any other programs that may be keeping the computer awake. If you exit all running programs (you may want to consider checking programs that are running in the background as well) and turn off all sharing under 'System Preferences' -> 'Sharing' and close the lid does it still exhibit the same problems.

Solution 2:

I know you've tried similar things, but hopefully with a few more details this will work for you. Please note: using pmset -g for troubleshooting this problem is about getting information, it doesn't actually make changes.

In the Terminal, run

pmset -g assertions

You should see something like:

16/08/13 1:24:58 PM GMT+
Assertion status system-wide:
   PreventUserIdleDisplaySleep             0
   CPUBoundAssertion                       0
   DisableInflow                           0
   ChargeInhibit                           0
   PreventSystemSleep                      0
   PreventUserIdleSystemSleep              1
   ExternalMedia                           0
   DisableLowPowerBatteryWarnings          0
   EnableIdleSleep                         1
   NoRealPowerSources_debug                0
   UserIsActive                            0
   ApplePushServiceTask                    0

Listed by owning process:
  pid 7928: [0x00001ef8012c14ca] PreventUserIdleSystemSleep named: "there are active torrents"

Kernel Assertions: None

If it includes PreventUserIdleSystemSleep 1, then there is some software that is preventing the sleep. The section Listed by owning process: shows relevant processes, which you can kill if necessary (e.g. kill process with id 7928 by running kill -9 7928).

This solved the problem for me. There were two relevant processes: Internet Sharing and a BitTorrent client. With sharing disabled, the sleep on lid close functionality was restored. I left the BitTorrent client running (and therefore PreventUserIdleSystemSleep remained set), because I don't actually want it to sleep when idle, just when I ask it to.

I found the solution here.