How do you prevent your laptop battery from draining while sleeping?

My fiancee has a 2016 13" MacBook Pro. She doesn’t use it very often - every few weeks or even less.

She finds that when she picks it up the battery is usually very low, so she has to plug it in.

Is there anything I can do to stop this? I’ve already checked the usually things - Power Nap is turned off, it’s not plugged into any external devices, and so forth.

I seem to remember from long ago when using the pmset command that there used to be a mode where the Mac would write the memory image to disk rather than holding it in ram. Is that deep sleep mode still a thing? Is there a way to force the Mac into that mode quicker - say after 24 hours?

If she only uses it once every few weeks, completely shutting it down is probably your best option. She can set it to reopen the windows she had open, but a complete shutdown will make sure the Mac isn’t thinking it has software-ish stuff to do while it’s powered off.

7 Likes

It sounds like you’re talking about hibernation. From the pmset man page:

hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want “hibernation” - slower sleeps, slower wakes, and better battery life, you should use this setting.

However, as suggested by your next question, you might prefer something a little less drastic than always using hibernation:

It sounds like you’re looking to control the timing of the “standby” transition between sleep and hibernation. Going back to the pmset man page:

standby causes kernel power management to automatically hibernate a machine after it has slept for a specified time period. This saves power while asleep. This setting defaults to ON for supported hardware. The setting standby will be visible in pmset -g if the feature is supported on this machine.

standbydelayhigh and standbydelaylow specify the delay, in seconds, before writing the hibernation image to disk and powering off memory for Standby. standbydelayhigh is used when the remaining battery capacity is above highstandbythreshold , and standbydelaylow is used when the remaining battery capacity is below highstandbythreshold.

highstandbythreshold has a default value of 50 percent.

So, summarizing the above notes from the pmset man page:

If you always want to hibernate immediately rather than sleeping, you could set hibernatemode to 25:

sudo pmset -a hibernatemode 25

If you’d prefer to control the timing of the standby transition from sleep to hibernation, try adjusting the “standby delay” parameters. For example, this would use a 24-hour standby delay when power is above 50 percent, switching to a 15-minute delay when power is below 50 percent.

sudo pmset -a highstandbythreshold 50
sudo pmset -a standbydelayhigh 86400
sudo pmset -a standbydelaylow 900

Hope this helps!

5 Likes

What an amazing appearance @kcase. Didn’t know you are a member in this forum. Wish you all the best.

2 Likes

If Ken Case is in the building … we can all sit back and watch the show :laughing:

3 Likes

Omnipresence demonstrated

3 Likes

Following up on Ken Case’s useful answer:

After getting a 14" MBP for myself, I ran into same problem I described above. I use my laptop a few times during the week, and I was finding the charge noticeably depleted when I left it alone for a few days.

Following Ken’s explanation, I attempted to use hibernatemode=25 along with the standbydelayhigh and standbydelaylow parameters. I discovered that Apple Silicon Macs ignore the parameters; if you set 25 as the mode, the laptop will immediately hibernate when you close it regardless of any additional standby parameters. (See macos - Can't find standbydelayhigh and standbydelaylow on MacBook Pro 2021 - Ask Different)

To work around this I’ve enlisted Keyboard Maestro. I have a KM macro (I called it ‘Deep Sleep’) which causes the laptop to hibernate the next time I close it:

sudo pmset -a hibernatemode 25

I added pmset to /private/etc/sudoers.d/pmset to avoid the sudo password prompt:

% cat /private/etc/sudoers.d/pmset
holbrook ALL=NOPASSWD: /usr/bin/pmset

I made another KM trigger that fires every time the laptop wakes to turn off hibernate if it’s on:

pmset -g | grep hibernatemode | grep 25 && sudo pmset hibernatemode 3

If think I’m not going to use my laptop soon, I trigger my Deep Sleep macro (using Alfred, so only a few keystrokes), and when I close the laptop, it hibernates. When it next weeks up, it turns off hibernation mode until I tell it to hibernate again.

It’s fiddly and manual, but I’ve achieved my goal: if I guess I’m not going to be using the laptop again for a few days, putting it into hibernation keeps my battery level right where I left it.

Of course, by doing so my Mac does not get the chance to run the various housekeeping tasks it would normally do, but I’m happy with the tradeoff.

Don’t the 14" M1 MBP models start up rather quickly (compared to Intel)? If I had a problem with significant loss of battery while sleeping over a few days time (which I don’t on my M1 MacBook Air) I would simply turn it off since startup is so darn quick.

I might also try the new Sleep Aid app to get to the bottom of the problem. A Mac should be expected to behave better than that. :slightly_smiling_face:

3 Likes

I did some tests. I have a 32GB 14" MBP with 1 TB SSD.

Time to password prompt following wake from hibernate: 18-19 seconds. Once I put in the password, all apps are available immediately.

Boot with restarting the apps I have open now:

  • 15 seconds to password prompt (encrypted disk)
  • 1m 15" to all apps open. (including the 15")

Apps start opening, immediately after password. I did have a fair number of apps open: Chrome, Safari, Day One, Notes, 1Password, Slack, Messages, Keyboard Maestro, iTerm, News, Fantastical, Things, Tweetbot, Reeder, Find My + login items Alfred Moom, SoundSource, Dropbox, Default Folder X, Typinator, CCC Dashboard, Chronosync scheduler.

So hibernation is still a clear win in my case.

I don’t have good numbers on how much battery I was losing, but my sense is that for 2-3 days I might lose 20% or more. Looking at the pmset logs, I can see it is waking up briefly - every 5 minutes or so. Looks like mDNSResponder is responsible for most of the wakes.

I’ve just downloaded Sleep Aid to see what it can tell me.

1 Like

Mine just doesn’t do that. I have a M1 MacBook Air. The only time it drains is when I am on it a great deal.

I’d do what was recommended: shut it down.