# Managing PreventUserIdleSystemSleep on MacBook

I have had some issues with the battery on my MacBook draining prematurely with the lid shut, and I think I have found a clue.

Following advice found elsewhere on the Web, when I issue:

pmset -g assertions


I see:

PreventUserIdleSystemSleep     1


The associated message is:

pid 10945(AddressBookSourceSync): [0x0000d8f9000192d5] 00:01:32 PreventUserIdleSystemSleep named: "Address Book Source Sync"
Timeout will fire in 1707 secs Action=TimeoutActionTurnOff


I gather that this is causing my MacBook to stay awake when the lid is shut, thus draining my battery. It’s not always the same process (Address Book Source Sync), and sometimes there is more than one process.

I don’t imagine that it’s supposed to be working that way, since it’s not supposed to drain my battery. How can I manage PreventUserIdleSystemSleep?

The value of that setting is not the only factor involved. I don't have a 0 for the PreventUserIdleSystemSleep and my MacBook Pro sleeps fine when I close the lid. Still, if you kill the process in question (the terminal command for your example would be "kill 10945"), you might be able see whether that could be involved. If that's all it took to let the computer sleep, then you'd have a way to manage it.

I'll give you an AppleScript that will let you kill the processes that give PreventUserIdleSystemSleep a "1". You can run the script, enter admin password to confirm when prompted, then run "pmset -g assertions" in Terminal again to confirm that they're all gone. Then close the lid to see if the MacBook sleeps. I can't promise that doing it won't lock up your computer or make it shut down, so be ready for that.

repeat
try
set pid2kill to word 2 of (do shell script "pmset -g assertions | egrep \"PreventUserIdleSystemSleep named\"")
do shell script "kill" & space & pid2kill with administrator privileges
on error
exit repeat
end try
end repeat