23

can someone please explain to me what my Mac does while asleep? I am running the latest version of Big Sur (11.4 (20F71)), so I think this is intentional, but I'm not sure why. I have turned off all the battery/power settings that could be the cause (Power nap, etc..)

Please see this screenshot of the times the cpu was working (using istat menus)

enter image description here

Thanks

  • 15
    And is iStat menus running while your Mac is sleeping, to provide this graph? ;-) Uninstalling istat menus is an excellent way to reduce worry about what your Mac is doing. – benwiggy Jul 05 '21 at 09:19
  • 5
    Good point, but iStat menus doesnt launch it self for no reason, something wakes up the computer and it logs the data, at least I think iStat menus is not supposed to wake up the computer for no reason.... – dcinderdiu Jul 05 '21 at 11:42
  • 2
    @benwiggy iStatMenus only shows wakes where there has been significant activity. It does not show for brief wakes or changes to sleep states. It is excellent first indication that something is waking the computer and, for a laptop, causing battery drain. – Gilby Jul 05 '21 at 23:39
  • 1
    @benwiggy I would love to not worry about it, but numerous times I've woken up to find my MacBook in my backpack running overnight until it's practically red hot. Not good. – Alexander Jul 06 '21 at 18:32
  • 1
    It definitely does not dream of electric sheep!! – RonJohn Jul 06 '21 at 19:07
  • Time for a comment that infuriates the fan boys: Apple's opacity has become too prominent to ignore. That they provide inadequate documentation to troubleshoot this issue strikes me as an affront to their customers. You buy the machine they make, but you do not control it - they do. Does that sound even remotely "user-friendly"? – Seamus Jul 07 '21 at 16:02

2 Answers2

20

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.

Gilby
  • 10,852
  • 4
    If "Find My Mac" is enabled, then it must wake up sometimes. My Mac certainly reports its position while left asleep for days. – Dmitri Urbanowicz Jul 06 '21 at 08:40
  • @DmitriUrbanowicz "Find My Mac": I wonder if power management log reports it? Have a look. I've got mine so locked down it doesn't even do any Dark Wakes during the night, so I am sure "Find My Mac" would not get updates. – Gilby Jul 06 '21 at 09:30
  • Yeah, it probably simply relies on tcpkeepalive. – Dmitri Urbanowicz Jul 06 '21 at 14:51
  • Why did you put a star on Wake*? – Thomas Ayoub Jul 07 '21 at 15:02
  • @ThomasAyoub. Good question! I have been using that so long that I don't remember why the . And a test just now shows no extra results from using the . – Gilby Jul 07 '21 at 22:13
6

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

benwiggy
  • 35,635
  • 1
    Should this happen with Power Nap disabled? – nohillside Jul 05 '21 at 09:16
  • 1
    I don't know for certain, but I wouldn't be surprised if Macs were still doing things while sleeping, even with Power Nap off. – benwiggy Jul 05 '21 at 09:24
  • I don't have a backup plugged in to my computer at night, nor does the machine backup remotely... – dcinderdiu Jul 05 '21 at 10:33
  • It's possible that the TM process launches, checks to see if there's a disk, and then quits. – benwiggy Jul 05 '21 at 11:20
  • 1
    As stated earlier, I have the Power Nap option set to off, so the computer really can't be checking for any time machine backups – dcinderdiu Jul 05 '21 at 11:41
  • 4
    Have you looked through the logs to see if any messages correspond with those times? – benwiggy Jul 05 '21 at 12:53
  • @dcinderdiu It is easy to check for TM being the cause - just look at the folders (or volumes) on the TM disk. As benwiggy says, the Mac will be doing things whilst supposedly sleeping. – Gilby Jul 05 '21 at 23:42
  • 3
    Time Machine makes a local snapshot every hour or so, even if the Mac is sleeping, and even if no TM disk is plugged in. BigSur Help for 'local snapshot' says "Local snapshots are only stored on disks using Apple File System (APFS) when Back Up Automatically is selected in Time Machine preferences." – Bob Werner Jul 06 '21 at 16:49