The all-around Macbook wakes up from Sleep Mode (or Wi-Fi) Bug
Today I woke up from my Macbook because it woke up from sleep. I literally woke up from sleep and was totally confused what caused it. Turns out this problem is really hard to debug and googling for it will give you a shitload of users asking for generic questions, always posting answers that have literally zero correlation with the problem.
So, what’s the problem? The problem is not a simple one, it’s caused by multiple annoying settings that the Macbook (in particular OSX El Capitan) ships with.
1. Disable Wake Up on LAN
Open the System Preferences, go to “Energy Saver” and make sure that you disable “Wake for Wi-Fi network access” and “Enable Power Nap” (in both Battery Mode and Power Adapter Mode). Take the screenshot on how it should look like after you did that:
2. Add a Wi-Fi Location
Yes, I’m serious here. Another bug related to this problem will cause the Macbook to wake up when you don’t have a named Location. In defaulted Automatic mode it will wake up resulting to random connections to other Wi-Fis. This took me like 2 hours to debug.
Open the System Preferences, go to “Network”, select “Edit Locations” from the Select Menu on the Top. Create a new Location (that is not named “Automatic”), select it and click Done. It will look like this if you did everything correctly:
3. Change the MTU of your Wi-Fi
Yes, I’m serious again. Another bug will cause the Hardware to wake up and ignore all settings if your MTU is not set right. From the security perspective I can’t express how wrong it feels to even write something like this down here. You can find things about this bug of users posting something like “Macbook 2015 slow Wi-Fi” and randomly find some guys having Sleep Mode problems. Turns out my Macbook Pro is also affected.
Open the System Preferences, go to “Network”, click the “Advanced” button on the Bottom Right, select the “Hardware” tab on the Right. Now select “Configure” and set it to “Manually”. Select “MTU” and set it to “Custom”.
In the newly appearing input field, enter the value “1453”. I repeat, the value is “1453”, NOT 1500 as the standard value. Click OK and Apply to save the changes. It should look like this if you did everything correctly:
4. Figure out what caused Wake Reasons
This took me quite long as well, in the “Console” (Spotlight > Console) you can filter for the term “Wake Reason” and it will show you a bunch of results.
In my case there were a lot of Wake Reasons related to ARPT (which means AirPort and is related to Wi-Fi and yes, it should not be there, because we deactivated it already. But it will still appear, thanks Apple). But that’s not the trouble-causing one, if there’s something like “Wake Reason: ?” you might have an App open that prevents the Macbook from really going to “real sleep mode”.
The Macbook will look like it sleeps, it will lock the screen when opening the Lid again — but it won’t be sleeping fo’ real and activate your external hard drive every 15 minutes in sleep mode. There are couple hundred posts about this on the interwebz, but most guys had no clue what caused it. But I think I’ve figured it out.
5. Figure Out what prevented Sleep Mode
Open the “Activity Monitor” (Spotlight > Activity Monitor). This System App will help you to find the opened App that prevents Sleep Mode. In my case I figured out that VLC has a Sleep Mode Prevention Bug which literally is completely ignored by the developers.
Anyways, in the Activity Monitor you need to go to the “Energy” Tab in the Center Top. In this view there’s a bunch of Apps opened, but the important part is on the Right. There’s a column named “Preventing Sleep Mode”. If there’s a Yes, that’s bad.
And if you look closely in the screenshot, the trouble-causer is VLC in my case. Thankfully my Macbook can now rest in peace again without waking me up.