Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mixolyd

macrumors member
Original poster
Jul 10, 2014
74
32
Oregon
Backstory: I just got a 2016 13'' non TB MBP. I noticed that after sleeping for a day or two, there was some battery drain. I also have a 2014 rMBP which does not drain at all. I tested and it seemed to drain 5% over 24 hours while the 2014 did not. After pulling my hair out trying to find a fix, I finally found one. Credit goes to Seny on the official Apple forums who figured it out. Link The issue seems to be that 2015 and 2016 MBPs are set to wake up during sleep for notifications. If I ran "log show --style syslog | fgrep "Wake reason" I'd have wakes every 10-20 minutes.

To see if you are affected, run "ioreg -l | grep IOPlatformFeatureDefaults" -- On my 2014 model TCPKeepAliveDuringSleep was set to No, but on my 2016 it was set to Yes.

In order to change this, first you have to turn off SIP. Boot into recovery mode (CMR+R) then "csrutil disable" (don't forget to enable again later). Then in Finder menu Go to folder "/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources" Depending on which MBP you have, the file you have to edit is different. Run " ioreg -l | grep board-id" in terminal to figure out the correct file. Then right click on the file, get info, change permission for Everyone to read & write. Open with texteditor (I used Textwrangler) and look for these 4 entries and just completely delete them

> <key>TCPKeepAliveDuringSleep</key>
> <true/>
> <key>TCPKeepAliveExpirationTimeout</key>
> <integer>43200</integer>
> <key>NotificationWake</key>
> <true/>
> <key>DNDWhileDisplaySleeps</key>
<false/>


Save and reboot. Worked for me. Now I have very few wakes when sleeping and battery drain is much better. I'm reporting the bug to Apple. Please do the same so they fix it. Whatever changes you make will probably be overwritten by any updates so they'll need to fix it permanently


Update: I no longer recommend using this fix. Something changed in 10.12.4. After redoing the steps outlined, I saw that the drain was about the same as without the fix, but then for the next days saw that it actually was worse. One night my battery dropped 10% overnight, and pmset showed no wakes. Very odd. I had to revert to a Time Machine backup because simply undoing the steps by changing the text does not revert this for whatever reason. So my suggestion is that if you are on 10.12.4 then do not follow this guide and learn to live with the slight drain that occurs. I'm not aware of any fix at the moment. Note this is with a 2016 MBP nTB so it may be different with 2015 or the regular MB.
 
Last edited:
Tried it, gonna report if this helps.
May I ask why is this turned on by Apple in the first place? Must have served some purpose.
 
I have been trouble shooting battery issues on the 13" TB and 15" TB models. I came to the same theory as you, that the laptops were waking while 'asleep' due to notifications from apps like imessages or facebook.

Just wondering if in your notifications system settings -> do not disturb, you had the 'When the display is sleeping' radio button turned off? I enabled this setting so that the computer would not wake while the display is sleeping, and this significantly improved my battery life while the laptop was asleep.
 
Backstory: I just got a 2016 13'' non TB MBP. I noticed that after sleeping for a day or two, there was some battery drain. I also have a 2014 rMBP which does not drain at all. I tested and it seemed to drain 5% over 24 hours while the 2014 did not. After pulling my hair out trying to find a fix, I finally found one. Credit goes to Seny on the official Apple forums who figured it out. Link The issue seems to be that 2015 and 2016 MBPs are set to wake up during sleep for notifications. If I ran "log show --style syslog | fgrep "Wake reason" I'd have wakes every 10-20 minutes.

To see if you are affected, run "ioreg -l | grep IOPlatformFeatureDefaults" -- On my 2014 model TCPKeepAliveDuringSleep was set to No, but on my 2016 it was set to Yes.

In order to change this, first you have to turn off SIP. Boot into recovery mode (CMR+R) then "csrutil disable" (don't forget to enable again later). Then in Finder menu Go to folder "/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources" Depending on which MBP you have, the file you have to edit is different. Run " ioreg -l | grep board-id" in terminal to figure out the correct file. Then right click on the file, get info, change permission for Everyone to read & write. Open with texteditor (I used Textwrangler) and change it like so:

<key>TCPKeepAliveDuringSleep</key>
<false/>
<key>NotificationWake</key>
<false/>
<key>DNDWhileDisplaySleeps</key>
<true/>.

Save and reboot. Worked for me. Now I have very few wakes when sleeping and battery drain is much better. I'm reporting the bug to Apple. Please do the same so they fix it. Whatever changes you make will probably be overwritten by any updates so they'll need to fix it permanently
Thanks for this. But I'm wondering how this is different from forcing a hibernate with the "sudo pmset" command? If you don't want the MBP waking for notifications, isn't it essentially doing the same thing as hibernating - remaining in low power with no waking or any other interruptions to a sleep/hibernate state? I'm not suggesting one is better than another, I am just not clear on the practical differences. Also, the forcing hibernate seems to be a simpler fix with a single command line. I was unsuccessful in doing this, but that's another issue.
 
Wow. Good stuff here, thanks a bunch!

I am currently having a problem with my MBPTB draining ~20% overnight, so definitely poses some concern.

Will try this solution will report back.
 
Yes, Apple's power nap. The computer wakes up a bit every so often to check for notifications and email.

Apple's KB articles goes into more detail: https://support.apple.com/en-us/HT204032

upload_2017-1-11_15-39-8.png

ed39951f-d4af-4d7b-bc1d-e51ef8efde8d

Even when Power Nap is off in the settings, its still working?
 
Last edited:
Mixolyd,

Did you completely remove the 'TCPKeepAliveExpirationTimeout'? I changed the other parameters, but not sure if leaving 'TCPKeepAliveExpirationTimeout' at 43200 seconds will affect it.
 
I have been trouble shooting battery issues on the 13" TB and 15" TB models. I came to the same theory as you, that the laptops were waking while 'asleep' due to notifications from apps like imessages or facebook.

Just wondering if in your notifications system settings -> do not disturb, you had the 'When the display is sleeping' radio button turned off? I enabled this setting so that the computer would not wake while the display is sleeping, and this significantly improved my battery life while the laptop was asleep.

Yep - I did the same and had the same results.
 
Intrestringly enough, on beta 4 the command
ioreg -l | grep IOPlatformFeatureDefaults
is not working.

And now I see that that is it because the option to power wake up has been completely removed from the Energy Saver.
 
https://support.apple.com/kb/PH25743
Terminal commands are unnecessary. DND can be enforced by following the instructions listed at the Apple KB article linked above.

This has nothing to do with DND. DND is for when your computer is awake. The issue is that the computer was being woken up during sleep (and while on battery) to receive push notifications. DND by default turns on when the display is sleeping, and I have that enabled.

Yes, Apple's power nap. The computer wakes up a bit every so often to check for notifications and email.

Apple's KB articles goes into more detail: https://support.apple.com/en-us/HT204032

Power nap is only when the computer is plugged in. I also tried completely disabling power nap and it made no difference.

https://support.apple.com/en-ca/HT204353

I have been trouble shooting battery issues on the 13" TB and 15" TB models. I came to the same theory as you, that the laptops were waking while 'asleep' due to notifications from apps like imessages or facebook.

Just wondering if in your notifications system settings -> do not disturb, you had the 'When the display is sleeping' radio button turned off? I enabled this setting so that the computer would not wake while the display is sleeping, and this significantly improved my battery life while the laptop was asleep.

I think I had DND while sleep set to on. Isn't that the default setting? Was yours off by default?

I'm curious if you run "log show --style syslog | fgrep "Wake reason"" do you see ARPT Network wakes? Those were the ones I had very often before

Thanks for this. But I'm wondering how this is different from forcing a hibernate with the "sudo pmset" command? If you don't want the MBP waking for notifications, isn't it essentially doing the same thing as hibernating - remaining in low power with no waking or any other interruptions to a sleep/hibernate state? I'm not suggesting one is better than another, I am just not clear on the practical differences. Also, the forcing hibernate seems to be a simpler fix with a single command line. I was unsuccessful in doing this, but that's another issue.

You could force hibernate, and I thought of doing that, but then your mac wakes up slower. The difference is that sleep stays in RAM while hibernate stays in SSD. It's up to you whether waking up slower is bothersome. For me I prefer waking up quickly with sleep.

Mixolyd,

Did you completely remove the 'TCPKeepAliveExpirationTimeout'? I changed the other parameters, but not sure if leaving 'TCPKeepAliveExpirationTimeout' at 43200 seconds will affect it.

I just kept TCPKeepAlive as is and didn't touch it.

Intrestringly enough, on beta 4 the command
ioreg -l | grep IOPlatformFeatureDefaults
is not working.

And now I see that that is it because the option to power wake up has been completely removed from the Energy Saver.

Seriously? Hmmm, have you tried the rest of the instructions? When you go to edit the file that's relevant for your computer, do you still see TCPKeepAliveDuringSleep?
[doublepost=1484277555][/doublepost]
Tried it, gonna report if this helps.
May I ask why is this turned on by Apple in the first place? Must have served some purpose.

see this https://support.apple.com/en-ca/HT204353 It's a new 'feature'. It does say on the bottom that DND disables this. I do believe I had DND while sleeping enabled in Notifications setting, as that is the default setting. Maybe it's a bug that DND while sleeping isn't disabling the push notifications. Not sure.
 
Last edited:
  • Like
Reactions: t2nerb
This has nothing to do with DND. DND is for when your computer is awake. The issue is that the computer was being woken up during sleep (and while on battery) to receive push notifications. DND by default turns on when the display is sleeping, and I have that enabled.



Power nap is only when the computer is plugged in. I also tried completely disabling power nap and it made no difference.

https://support.apple.com/en-ca/HT204353



I think I had DND while sleep set to on. Isn't that the default setting? Was yours off by default?

I'm curious if you run "log show --style syslog | fgrep "Wake reason"" do you see ARPT Network wakes? Those were the ones I had very often before



You could force hibernate, and I thought of doing that, but then your mac wakes up slower. The difference is that sleep stays in RAM while hibernate stays in SSD. It's up to you whether waking up slower is bothersome. For me I prefer waking up quickly with sleep.



I just kept TCPKeepAlive as is and didn't touch it.



Seriously? Hmmm, have you tried the rest of the instructions? When you go to edit the file that's relevant for your computer, do you still see TCPKeepAliveDuringSleep?
[doublepost=1484277555][/doublepost]

see this https://support.apple.com/en-ca/HT204353 It's a new 'feature'. It does say on the bottom that DND disables this. I do believe I had DND while sleeping enabled in Notifications setting, as that is the default setting. Maybe it's a bug that DND while sleeping isn't disabling the push notifications. Not sure.

DND is not just for when the system is awake. DND can apply even to a Mac that is in sleep mode. Notifications can still be sent to a Mac that is asleep, such as in environments where a Bonjour proxy is running (ie: AirPort base stations or Apple TVs are on the network,) unless you turn on DND like stated at the link I provided:

"Stop notifications during the time range you specify, when the display is sleeping, or when you’re projecting the screen."
 
DND is not just for when the system is awake. DND can apply even to a Mac that is in sleep mode. Notifications can still be sent to a Mac that is asleep, unless you turn on DND like stated at the link I provided:

"Stop notifications during the time range you specify, when the display is sleeping, or when you’re projecting the screen."

DND while display is sleeping is On by default. If that's the case then this shouldn't be happening
 
DND while display is sleeping is On by default. If that's the case then this shouldn't be happening

It's not on by default on my system. Granted, it's not a 2016 model, but that doesn't rule out a bug in he case of the 2016's, plus I'm running 10.12.3 beta4, so that could be part of it too.
 
You could force hibernate, and I thought of doing that, but then your mac wakes up slower. The difference is that sleep stays in RAM while hibernate stays in SSD. It's up to you whether waking up slower is bothersome. For me I prefer waking up quickly with sleep.
In theory I agree, but these SSD's are supposed to be much faster now. I would guess that waking up from hibernate doesn't take very long. I don't know how I can confirm if my MBP was in hibernate vs. sleep, but when I leave it on sleep overnight, I assume it's in hibernate by then, and it always wakes up pretty fast. Just talking, I don't really have a strong preference either way, I just want it to stop draining.

The only reason I couldn't do your method is that I can't replicate your keystrokes. "ioreg -l | grep board-id" what are those vertical lines? They are different but I only know of one vertical line option on the keyboard. Sorry if noob question.
 
It's not on by default on my system. Granted, it's not a 2016 model, but that doesn't rule out a bug in he case of the 2016's, plus I'm running 10.12.3 beta4, so that could be part of it too.

I just backed up and going to reinstall OSX to confirm whether it's on by default or not. If it's as simple as turning that on then that would be much easier and preferable

In theory I agree, but these SSD's are supposed to be much faster now. I would guess that waking up from hibernate doesn't take very long. I don't know how I can confirm if my MBP was in hibernate vs. sleep, but when I leave it on sleep overnight, I assume it's in hibernate by then, and it always wakes up pretty fast. Just talking, I don't really have a strong preference either way, I just want it to stop draining.

The only reason I couldn't do your method is that I can't replicate your keystrokes. "ioreg -l | grep board-id" what are those vertical lines? They are different but I only know of one vertical line option on the keyboard. Sorry if noob question.

Ok I'm not just talking theory here. I did force hibernate and it was slower to wake up. I have a new 2016 MBP so definitely not a slow SSD. I don't remember how much longer it took, but you can try it yourself and see. For me it was definitely noticeable. And I doubt your MBP is in hibernate since by default it's sleep. You can google how to change it. I don't remember the command

The vertical line is | which is when you hold shift and press the key above enter/return. You could just copy and paste the command.
 
I just backed up and going to reinstall OSX to confirm whether it's on by default or not. If it's as simple as turning that on then that would be much easier and preferable



Ok I'm not just talking theory here. I did force hibernate and it was slower to wake up. I have a new 2016 MBP so definitely not a slow SSD. I don't remember how much longer it took, but you can try it yourself and see. For me it was definitely noticeable. And I doubt your MBP is in hibernate since by default it's sleep. You can google how to change it. I don't remember the command

The vertical line is | which is when you hold shift and press the key above enter/return. You could just copy and paste the command.
Maybe I'm doing it wrong then. In recovery mode, I don't have access to safari or notepad or anything else outside of terminal and finder, right? So copy/paste is out. Also there are 2 vertical lines in your string and they appear to be different. I know the one you are talking about, but isn't that a smaller vertical line in front of this one?

I was unsuccessful in forcing hibernate too. In terminal it said I didn't have permission or something like that. Maybe I need to do it in recovery too, maybe with csrutil disabled too. I don't know what any of this is, just trying to follow instructions. DOS commands and rebuilding RAR files seem so far away now.
 
I tried hibernatemode 25 and it took longer for my MacBook to wake up than it would to boot. On top of that, all the external disks were ejected improperly and I had to dismiss the notifications of such.
 
Ok so I reinstalled OSX. DND while sleep is not On by default in Notifications settings. I was wrong about that. I switched it to On, but I'm still seeing a bunch of these ARPT Network wakes (coinciding to whenever I get a new email or some other notification), so it seems that simply switching DND while display is sleeping to On does not fix this (contrary to Apple's article on Enhanced Notifications). Maybe it's a bug. If I do "ioreg -l | grep IOPlatformFeatureDefaults" then DNDWhileDisplaySleeps is still set to No.

So unfortunately until Apple fixes this, you have to follow the directions in the OP. Or turn on hibernation if you don't mind longer wake times.
 
Last edited:
Thanks for this heads-up, I had these wake problems on the 2015 13" MBP lots of times, I have strongly suspected that the TCP connection will cause this, since the machine was trying to find WiFis around when closed in my backpack - and when I disable WiFi before closing the lid, no drain happens (I scripted it to shut wifi automatically when going to sleep and then enable it again, but it was not consistent and also it took much longer to find wifi when opened). But had no idea where to look for in OSX. Will try the keepalives disabled, they could be helpful for some services like VPN (and also for the notifications if one wants them, but I definitely not) but for most people they don't make any sense to be on when on sleep.
 
Putting every time the Macbook in hibernation means writing 8/16gb of data (depending on your ram) on the SSD, don't know how healthy that might be. However, I just noticed that mine wakes up too when the lid is closed. From my other Macbook every hour I get a notification from Steam saying that the Macbook nTB is available for streaming, and one minute later that is not available anymore.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.