Determine Why Your Mac Wakes Up From Sleep
Have you ever put your Mac to sleep, only to find it awake seemingly on it’s own when you return to the machine? I’ve run into this mystery a few times, and with a few terminal commands you can help track down what caused your Mac to wake from sleep.
Launch the Terminal and type the following at the command line:
syslog |grep -i "Wake reason"
You will then see a report from the system logs that looks like the following:
Sat Jul 10 08:49:33 MacBookPro kernel
Sat Jul 10 17:21:57 MacBookPro kernel
Sun Jul 11 08:34:20 MacBookPro kernel
Sun Jul 16 18:25:28 MacBookPro kernel
Now you’re going to want to look at the code next to the “Wake reason=” text. So what do these wake reason codes mean?
- OHC: stands for Open Host Controller, is usually USB or Firewire. If you see OHC1 or OHC2 it is almost certainly an external USB keyboard or mouse that has woken up the machine.
- EHC: standing for Enhanced Host Controller, is another USB interface, but can also be wireless devices and bluetooth since they are also on the USB bus of a Mac.
- USB: a USB device woke the machine up
- LID0: this is literally the lid of your MacBook or MacBook Pro, when you open the lid the machine wakes up from sleep.
- PWRB: PWRB stands for Power Button, which is the physical power button on your Mac
- RTC: Real Time Clock Alarm, is generally from wake-on-demand services like when you schedule sleep and wake on a Mac via the Energy Saver control panel. It can also be from launchd setting, user applications, backups, and other scheduled events.
There may be some other codes (like PCI, GEGE, etc) but the above are the ones that most people will encounter in the system logs. Once you find out these codes, you can really narrow down what is causing your Mac to wake up from sleep seemingly at random.
Note: You can also monitor the Wake Reason codes by looking at the Console if you are not comfortable with the command line. However, in my experience the Console is slower to search and use than the Terminal. This is usually because the default string match search in Console will look through all of your system and applications logs, including those from third parties.
Thank you to Matt for providing this awesome tip!