Apple - MacBook Pro continually wakes while in sleep mode
I found a fix. Seems that 2015 and 2016 MBPs are affected. This required disabling SIP and changing a system setting. I reported the bug to Apple so hopefully they'll fix it sometime soon. Please report it to them as well since any changes you make will be probably reverted with a system update.
From here: MacBook Pro 13 with Retina display consumes 10% battery overnight with the lid closed, is this normal?
and more details about it here https://discussions.apple.com/message/30869802#30869802
You have to turn SIP off, then do
ioreg -l | grep board-id
to get your board ID and then look for a file in the following directory that has your board ID as the filename (*.plist file)
/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources
Right click on the file > get info, and change permission for 'Everyone' to read and write (or edit this using sudo chmod a+rw *.plist
). Then change these key values with a text editor so that they match these settings:
<key>TCPKeepAliveDuringSleep</key>
<false/>
...
<key>NotificationWake</key>
<false/>
<key>DNDWhileDisplaySleeps</key>
<true/>
Finally, turn SIP back on and reboot.
I didn't found the exact cause of the problem, but I did found a solution which will avoid massive battery drains in sleep mode. The solution was to disable Airport (WiFi) when the Macbook was sleeping.
I used SleepWatcher v2.2 (http://www.bernhard-baehr.de) to run 2 scripts at wake and sleep interrupts. When the macbook goes to sleep, I execute the following command to disable WiFi:
/usr/sbin/networksetup setairportpower en0 off
When the Macbook wakes up again, I enable WiFi again:
/usr/sbin/networksetup setairportpower en0 on
You can download a script that installs SleepWatcher and the scripts at a blog post of mine (No ads located on the page).
Please note that in the original question of mine I said that I didn't want to disable WiFi constantly when putting the Mac to sleep. This solution does the same, but automatically, which makes it a good solution for the battery drain.
The sleep script:
#!/bin/bash
status=$(networksetup getairportpower en0 | grep -Ei "On$")
if [ -f /tmp/wifi.on ]; then
rm /tmp/wifi.on
fi
if [ "" != "$status" ]; then
echo "`date` -- WiFi is On ... storing statement" >> /tmp/sleep.log
touch /tmp/wifi.on
networksetup setairportpower en0 off
fi
The wake script:
#!/bin/bash
if [ -f /tmp/wifi.on ]; then
echo "`date` -- Enablig WiFi" >> /tmp/sleep.log
sleep 3
networksetup setairportpower en0 on
fi