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 of a randomly waking Mac a few times, and with a few terminal commands you can help track down what caused your Mac to wake from sleep.
Do know there are many reasons why this can happen, sometimes it’s a hardware event that causes the Mac to wake from sleep, sometimes it’s software, and sometimes it is something else. This guide will help to determine the reason for any Mac, iMac, MacBook Air, Pro, etc, waking from a sleep state. Yes it is slightly technical and uses the command line in OS X to look through system logs, and you’ll then need to compare a multiple character ‘wake reason’ code to a list shown below indicating what the actual sleep reason is. Let’s get started.
How to Find Out Why a Mac is Waking From Sleep
Launch the Terminal, found in /Applications/Utilities/ and type the following at the command line exactly:
syslog |grep -i "Wake reason"
Hit return and you will then see a report from the system logs in OS X that looks something 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, this is what is going to help to tell you why the computer is waking out of sleep. So what do these wake reason codes mean?
Wake Reason Codes & What They Mean in Mac OS X
We’ll describe each kernel debug wake reason code and what it pertains to, leading you to what is causing the machine to wake up.
- 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!