37

I just got a new Retina MacBook Pro 15". After getting some downloads interrupted due to the computer going to sleep (even on AC power), I started looking at the man page for the pmset command. I did solve my original problem with sleeping but a few options piqued my interest. In particular, here's the description for the autopoweroff setting from the man page:

autopoweroff - Where supported, enabled per default as an implementation of Lot 6 to the European Energy-related Products Directive. After sleeping for autopoweroffdelay minutes, the system will write a hibernation image and go into a lower power chipset sleep. Wakeups from this state will take longer than wakeups from regular sleep. The system will not auto power off if any external devices are connected, if the system is on battery power, or if the system is bound to a network and wake for network access is enabled.

And then there's the standby mode:

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.

standby only works if hibernation is turned on to hibernatemode 3 or 25.

standbydelay specifies the delay, in seconds, before writing the hibernation image to disk and powering off memory for Standby.

Now maybe I'm just being thick, but both options seem like they do essentially the same thing. The main difference I see is that standby requires a specific hibernatemode.

Concretely, the way I'd like to configure my computer is for it to do a RAM-only sleep (exactly like hibernatemode 0 does) when first closing the lid, so that it quickly goes to sleep, without writing the RAM contents to disk immediately. However, if I leave the computer sleeping with the lid closed for a certain number of hours (say 4 hours), I'd like it to only then write the RAM contents to disk and power off the computer, so as to save battery in case of an extended sleep. Ideally, I'd also like the second part (writing RAM to disk and power off) to happen only if the computer is running on battery power.

The reasoning here is that, for me, the common use case for sleeping is taking the computer from home to work and back, and there's no point in slowing down the sleep process and wasting SSD write cycles (as well as slowing down the wake-up process, if it does hibernate) if I'm just going to wake it up again in less than an hour; also, since the time it spends sleeping is so short, not much battery would be saved by shutting the computer down for such a short period.

How should I configure the hibernatemode, autopoweroff, autopoweroffdelay, standby and standbydelay options to achieve this behavior?

3
  • I have a question: on my Macbook pro 2015 (12,1) pmset -g shows: autopoweroffdelay 14400 I never changed it, so it is factory setting. But "man pset" shows: autopoweroffdelay - delay before entering autopoweroff mode. (Value = integer, in minutes) So with factory setting set to 14400, my mac will not go into safesleep before... 10 days ! Curious, isn't it ?
    – user153475
    Commented Oct 21, 2015 at 11:45
  • Im curious, how did you solve your download interruption problem?
    – Dickster
    Commented Apr 5, 2018 at 21:12
  • " common use case for sleeping is taking the computer from home to work and back" – If I understand correctly, the default settings should already do this. We only enter safe sleep after the standbydelay. You can check for yourself that before this the sleepimage is not modified.
    – 1110101001
    Commented Jan 2, 2021 at 1:24

4 Answers 4

15

The autopoweroff feature is also mentioned in http://support.apple.com/kb/HT1757:

With the release of the OS X Mountain Lion v10.8.2 supplemental update 2.0, a new feature was introduced to enter safe sleep after four hours of the computer being connected to AC power. This is an effort to comply with the European Energy Standards (ErP Lot6). This will only occur if there is no wireless or Ethernet activity and no activity from external devices such as USB storage devices.

This is normal behavior for the following models:

  • MacBook Pro (Mid 2012 and later)
  • MacBook Pro (Retina, Mid 2012 and later)
  • MacBook Air (Mid 2012 and later)
  • iMac (Late 2012 and later)
  • Mac mini (Late 2012 and later)

Standby mode is documented in http://support.apple.com/kb/ht4392:

Macs that can use standby mode:

  • MacBook Pro (Retina, 13-inch, Late 2012) and later
  • MacBook Pro (Retina, 15-inch, Early 2013) and later
  • MacBook Pro (Retina, Mid 2012)
  • MacBook Air (Mid 2010) and later
  • SSD and Fusion drive versions of Mac mini (Late 2012) and later
  • SSD and Fusion drive versions of iMac (Late 2012) and later

Mac computers manufactured in 2013 or later enter standby after three hours of "regular" sleep. Earlier computers activate after just over an hour of "regular" sleep.

To enter standby, the computer must:

  • Be running on battery power (if it is a Mac notebook computer).
  • Have no USB devices attached.
  • Have no Thunderbolt devices attached.
  • Have no SD card inserted.
  • Have no external display attached.
  • A computer with a fully charged battery can remain in standby for up to thirty days without being plugged in to an AC power source.

The state of the computer is saved to the flash storage (SSD), then the power to the hardware subsystems turns off to increase the length of the standby. For example, RAM memory and the USB bus are powered off during the standby.

So standby mode and autopoweroff are supported by different models of Macs and they are enabled under different conditions. Standby mode was introduced in 2010 and it was initially only supported by MacBook Airs, but it is now supported by all new Macs except Mac Pros, iMacs with no SSD, and Mac minis with no SSD. autopoweroff was introduced in 2012 and it is supported by all new Macs except Mac Pros.

I don't know if the state of being in standby mode is different from the autopoweroff state. A gray screen with a progress bar is shown when a Mac wakes up from both states.

Note that Apple has used "safe sleep" to refer to both the hybrid sleep and hibernation mode that laptops use by default (like in http://support.apple.com/kb/PH11096) and to the hibernation-only state (like in the first block quote above).

Even if you set standbymode to 0 and disable standby mode and autopoweroff, you won't waste that much energy. New laptops use about 0.7-1W of energy in sleep mode and about 0.2-0.3W when off or in hibernation mode.

2
  • 2
    So it seems the main difference is that autopoweroff is applied to AC power and standby to battery power? I guess standby mode is what I really need then.
    – swineone
    Commented Dec 16, 2013 at 11:31
  • 1
    When talking about energy waste, please multiply your numbers by the number of laptops on the planet. Also, perhaps I'm missing something but why would anything use power "when off"?
    – eggyal
    Commented Feb 3, 2016 at 10:12
44

I tried to summarize all the settings in a picture.

For OS X 10.9 (it would be a little different with newer OS)

Sleep Standbysource

I would say there are just two "modes": Sleep and Hibernation

  • Sleep: data will be kept in memory.
  • Hibernation: (or Standby? SafeSleep? DeepSleep?) data will kept in hard disk and requires significantly less power consumption.

Here are summaries of my understanding..

  1. if [sleep == 0], the computer will not sleep or hibernate any more.
    • For notebooks, the effective setting automatically changes whenever the charger is plugged in
      • Normally, sleep minutes are simply equal to displaysleep minutes, which you can set in System Preferences > Energy Saver
      • But under the Power Adapter tab, checking "Prevent computer from sleeping automatically when the display is off" will override sleep minutes to 0
  2. if [standby == 1] and [hibernatemode == 3], the computer will wait another [standbydelay] seconds before really entering hibernation.
  3. [autopoweroff] is just an extra implementation to fulfill regulatory requirement and has the same impact equivalent to 2)
  4. either 2) or 3) takes effect if one of them is reached at first.
  5. if [standby == 1] and [hibernatemode == 25], the computer will enter hibernation immediately after [sleep] minutes.

Note: in MacOS 10.13 autopoweroffdelay specifies the delay, in seconds, before entering autopoweroff mode.

Can someone review and confirm the interpretation?? thanks

9
  • 1
    This image is amazing! Commented Dec 10, 2017 at 1:32
  • Great image! I believe the autopoweroffdelay is also in seconds (see man pmset)
    – Yvo
    Commented May 30, 2018 at 13:12
  • man pmset -> autopoweroffdelay - delay before entering autopoweroff mode. (Value = integer, in minutes)
    – elgcom
    Commented May 31, 2018 at 16:15
  • 1
    I wonder if the seconds/minutes thing varies per model. My man page says "autopoweroffdelay specifies the delay, in seconds, before entering autopoweroff mode".
    – Kelvin
    Commented Mar 21, 2019 at 22:36
  • Great graphic! But no comment explicitly confirming it, and not the top voted answer yet. If it would be confirmed, this answer would deserve to be the top answer, as the combination of infographic + explanation make it the most efficiently digestible answer.
    – porg
    Commented Apr 6, 2019 at 14:01
18

This hibernate/sleep thing has been driving me insane. And I agree that Apple should put more energy into fixing this pmset behavior.

I will be clear. I love hibernate mode and it used to work perfectly in older models and OSs (just running sudo pmset hibernatemode 25 was enough). Now Apple broke something and this just doesn't work since Yosemite.

I have a Retina now and now more than ever the hibernate option makes way more sense than the Sleep. I don't get why people having SSDs love Sleep over hibernate so much, I just don't understand they don't understand the wake up time difference between hibernate and sleep is 1 second but they save tons of battery, someone explain me what they see as the big advantage cause I don't get it. Anyways, (if you love hibernate as much as I do, continue reading) I wanted hibernate to work. It took me weeks to make it work and I will share what I did with you all.


You HAVE TO reset the SMC and then the NVRAM / PRAM first:

Reset the SMC (http://support.apple.com/kb/ht3964):

  1. Shut down the computer.
  2. Plug in the MagSafe power adapter to a power source, connecting it to the Mac if it's not already connected.
  3. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
  4. Release all the keys and the power button at the same time.
  5. Press the power button to turn on the computer.

Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.

Resetting NVRAM / PRAM (http://support.apple.com/kb/HT1379):

  1. Shut down your Mac.
  2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
  3. Turn on the computer.
  4. Press and hold the Command-Option-P-R keys before the gray screen appears.
  5. Hold the keys down until the computer restarts and you hear the startup sound for the second time.
  6. Release the keys.

Now execute these:

AC:

sudo pmset -c sleep 0
sudo pmset -c standby 0
sudo pmset -c standbydelay 5
sudo pmset -c hibernatemode 25

Battery:

sudo pmset -b sleep 120
sudo pmset -b standby 1
sudo pmset -b standbydelay 5
sudo pmset -b hibernatemode 25

All:

sudo pmset -a acwake 0
sudo pmset -a lidwake 0
sudo pmset -a ttyskeepawake 0
sudo pmset -a darkwakes 0

All done! Set the MacBook to sleep and when you wake it up you will see a progress bar before the computer is done. That means, the MacBook was hibernating! (note: I hate they removed the sleeping light from the MacBook Pro, that was very useful)

6
  • This worked for me using late 2008 macbook pro running El Capt. Commented May 19, 2016 at 21:46
  • Isn't hibernate superseded by autopoweroff aka deep-sleep? Or are you saying it is preferable?
    – Mr. Boy
    Commented Feb 22, 2018 at 11:04
  • I think the reason people don't like hiberate (at least with autopoweroff) is because it kills your Chrome tabs, kills your rails/nodejs server, kills your react native process, basically destroys your productivity as an engineer who doesn't have their laptop powered on overnight.
    – Eric G
    Commented Mar 12, 2019 at 20:24
  • Any idea on which command to disable the trackpad/keyboard wake-up? Commented Mar 26, 2019 at 7:46
  • @EricGoldberg - I think you are talking about "system resume on restart", where the system boots as normal and re-creates all windows. Hibernate is just another way of sleeping your Mac which uses much less power because RAM is saved to disk. See last section of the DeepSleep site including video showing difference. I'm not suggesting this tool, though it was quite convenient on El Capitan 10.11 to select hibernate vs normal sleep.
    – RichVel
    Commented Jun 16, 2019 at 7:13
3

This is a good compilation and juxtaposition of the two power management modes: standby vs autopoweroff, but the conclusions made above are not entirely correct IMHO.

I have a Macbook Pro 15" mid 2012 (non-SSD), and it supports both standby and autopoweroff. The articles quoted above do not show that MacBook Pro mid 2012 supports the standby mode; however, below is the output of the "pmset -g cap" command on my MacBook Pro:

$ pmset -g cap
Capabilities for AC Power:
 displaysleep
 disksleep
 sleep
 womp
 acwake
 lidwake
 halfdim
 sms
 gpuswitch
 standby
 standbydelay
 ttyskeepawake
 hibernatemode
 hibernatefile
 autopoweroff
 autopoweroffdelay

I have had all kinds of power management issues since Mountain Lion; The computer would hibernate after it would go to sleep, so I started looking into the "pmset" command. At times it did seem, however, that the "autopoweroff" hibernation would be triggered by the "autopoweroffdelay" timer but the "standby" hibernation would not be triggered by the "standbydelay" timer. Power management has never worked correctly since Mountain Lion - even in Mavericks.

I have just looked in the log of the pmset command, and it seems that my MacBook Pro was woken up "Dark Wake" at 11:02 PM "due to EC.ACAttach/Maintenance" and then again at 3:32 "due to EHC1/HID Activity". The AHC1/HID device is either my Logitech bluetooth keyboard or my Magic Trackpad.

pmset -g stats

4/17/14, 7:06:08 PM EDT  Sleep                  Clamshell Sleep: Using BATT (Charge:99%)                                              
4/17/14, 7:06:11 PM EDT  SlowResponse           PMConnection: Response from com.apple.apsd is slow (powercaps:0x0)                    3038 ms       
4/17/14, 7:06:34 PM EDT  Assertions             PID 33194(AddressBookSour) Released PreventUserIdleSystemSleep "Address Book Source Sync" 00:00:30  id:0x100000b31 [System: No Assertions]            
4/17/14, 7:06:34 PM EDT  Assertions             PID 172(UserEventAgent) Released BackgroundTask "com.apple.AddressBook.ScheduledSync" 00:00:30  id:0xc00000b32 [System: No Assertions]            
4/17/14, 7:06:36 PM EDT  Timedout               PMConnection: Response from CMacPowerHelper timed out (powercaps:0x0)                 27999 ms      
4/17/14, 7:06:36 PM EDT  WakeRequests           Clients requested wake events: None                                                   

4/18/14, 11:02:09 AM EDT                        Summary- [System: No Assertions] Using AC                                             
4/18/14, 11:02:14 AM EDT DarkWake               DarkWake [CDN] due to EC.ACAttach/Maintenance: Using AC (Charge:87%)        1 secs    
4/18/14, 11:02:14 AM EDT Timedout               Kernel: Response from Messages timed out (powercaps:0x9)                              30000 ms      
4/18/14, 11:02:14 AM EDT SlowResponse           Kernel: Response from powerd is slow (powercaps:0x0)                                  28003 ms      
4/18/14, 11:02:14 AM EDT Assertions             PID 16(powerd) Created InternalPreventSleep "com.apple.powermanagement.acwakelinger" 00:00:00  id:0xe00000b3f [System: PrevIdle SRPrevSleep kCPU]             
4/18/14, 11:02:15 AM EDT Wake                   DarkWake to FullWake [CDNVA] due to HID Activity: Using AC (Charge:87%)               
4/18/14, 11:02:17 AM EDT SlowResponse           PMConnection: Response from com.apple.notificationcenter.dnd is slow (powercaps:0x1f)             1536 ms       
4/18/14, 11:02:47 AM EDT Assertions             PID 33219(SubmitDiagInfo) Released PreventUserIdleSystemSleep "com.apple.SubmitDiagInfo.run" 00:00:36  id:0x100000b3e [System: PrevIdle BGTask SRPrevSleep kCPU]              
4/18/14, 11:02:59 AM EDT Assertions             PID 16(powerd) TimedOut InternalPreventSleep "com.apple.powermanagement.acwakelinger" 00:00:44  id:0xe00000b3f [System: PrevIdle BGTask SRPrevSleep kCPU]             
4/18/14, 11:02:59 AM EDT Assertions             PID 16(powerd) Released InternalPreventSleep "com.apple.powermanagement.acwakelinger" 00:00:44  id:0xe00000b3f [System: PrevIdle BGTask SRPrevSleep kCPU]             
4/18/14, 11:03:13 AM EDT Assertions             PID 33240(AddressBookSour) Released PreventUserIdleSystemSleep "Address Book Source Sync" 00:00:53  id:0x100000b5b [System: BGTask]           
4/18/14, 11:03:13 AM EDT Assertions             PID 172(UserEventAgent) Released BackgroundTask "com.apple.AddressBook.ScheduledSync" 00:00:53  id:0xc00000b5c [System: BGTask] 

4/19/14, 3:32:20 AM EDT  Wake                   Wake [CDNVA] due to EHC1/HID Activity: Using AC (Charge:99%)                7182 secs 

The MacBook Pro never entered the "hibernate" mode because I kept the "autopoweroffdelay" timer at its default value of 14,400 seconds (4 hours) for both Battery Power and AC Power. I manually set "standby delay" to 28,800 seconds (8 hours) for Battery Power and to 100,800 seconds (28 hours) for AC Power. The only way to know for sure which "hibernation" option kicks in - "autopoweroff" or "standby" - is to set one to a very short time interval - like maybe 1 hour after the Mac goes to "sleep". Then one can see which "hibernate" mode triggered the Mac to "hibernate".

Needless to say that it's unacceptable that Apple cannot get this working right for several years now. The features supported by the "pmset" command need to be cleaned up, and the supported options need to be available in GUI in System Preferences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .