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. So if you’re wondering why your Mac is waking from sleep, read on to learn how you can help determine the cause.
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 Mac 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, depending on your version of MacOS system software:
For macOS Monterey and Big Sur, try the following command:
pmset -g log |grep "Wake Request"
Which may reveal the direct process or app causing the wake up. Alternatively you can run the following command which also may show the process causing wake, but also the debug code that may help to discover the cause of the system wake:
log show |grep -i "Wake request"
For MacOS Sierra, Mojave, Catalina, and newer, with the new logging system, use the following command:
log show |grep -i “Wake reason”
For MacOS El Capitan, Yosemite, Mavericks, and older, with the traditional syslog command:
syslog |grep -i "Wake reason"
Hit return and you will then see a report from the system logs in Mac OS X that may look 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.
Did you find this useful for tracking down why a Mac woke from sleep? Do you have any other tips or suggestions for discovering similar information? Share with us in the comments below. And thank you to Matt for providing this awesome tip idea!