What does my Mac do while sleeping all night long?

Sleep States:

macOS has multiple layers of sleep. It is not as simple as suggested by the System Preferences Energy Saver choices, nor by this Apple page which makes it seem simple - either sleep or wake.

There is some description of sleep states in the power management man page. Use the Terminal command man pmset. But this is confusing because it mixes superficial description of states with commands which control those states.

I have found web searches to produce different, often contradictory, descriptions of sleep states. My list of sleeping states which is probably not complete and has one question mark:

  • Sleep - just the lid (on a laptop) closed. Screen off. RAM is still powered.
  • Safe Sleep - RAM has been written to disk (hence safe), but still powered.
  • Deep Idle - same as Safe Sleep?
  • Standby - RAM written to disk and RAM and USB powered off.
  • Hibernate - as standby, but everything powered off.

Note that except for hibernate, the Mac will 'Dark Wake' at intervals.

Diagnosis:

To diagnose what is happening we need to inspect the power management log. The detailed log is shown with the Terminal command:

pmset -g log

Whilst we need that for detailed understanding, useful subsets are:

pmset -g log | grep -e "Wake from" -e "DarkWake" -e "due to"
pmset -g log | egrep "\b(Sleep|Wake*|DarkWake|Start)\s{2,}"

We can now see the description for each wake. Amongst other reasons, these can relate timers or network activity. I do not know a source for a comprehensive or detailed explanation of the descriptions.

A byproduct of this is that many lines contain the current battery level, which gives us some idea as to how much the regular wakes are draining the battery.

Controlling sleep and wake (optional):

We can control these wakes - in particular, reduce them so that there is less battery drain. After turning off power nap, etc. in system Preferences, get the current power management parameters with:

pmset -g

There are two different sets depending on whether you have mains power connected or just using the battery. We are most interested in those under battery power and can change them with sudo pmset -b.

For my MacBook I drastically reduced overnight battery drain by disabling network wakes and reducing the time before the MacBook goes into deeper sleep states. My changes include:

  • sudo pmset -b tcpkeepalive 0 to turn off repeated network wakes.
  • sudo pmset -g standbydelayhigh 7200 (2 hours)
  • sudo pmset -g standbydelaylow 7200 (2 hours)
  • sudo pmset -g autopoweroffdelay 14400 (4 hours)

Don't make too many changes at once and (as used to be recommended) don't change hibernatemode to 25.


Some of those spikes look to be every hour, which would suggest Time Machine is launching.