MacBook – How to add hibernate mode to MacBook Pro

hibernatemacbook prosleep-wake

I have recently switched to Mac from Windows hence I do not have much information.

  1. I want my Mac to go to safe sleep state on closing the lid.
  2. I also need an extra option available somewhere which can be used to move to hibernate mode (no battery used at all).

I read safe sleep is default on closing lid and minimal battery is used at that time, but my Mac drains full battery in less than 2 days, which does not seem like "safe sleep".

I researched about it but every answer/blog mentions having only 1 option at one time, either hibernate or sleep. Also, some mention using mode 25 for hibernate and some mention using mode 1 for hibernate. I tried Mode 25, but it does not seem to be working (does it take time to fully implement?), and mode 1 seems to have risk involved. I do not want to risk losing data.

How can I achieve the desired behavior and also test wether it is working or not?

Currently in use:  
 standbydelay         4200  
 standby              0  
 womp                 1  
 halfdim              1  
 hibernatefile        /var/vm/sleepimage  
 sms                  1  
 networkoversleep     0  
 disksleep            10  
 sleep                0  
 autopoweroffdelay    14400  
 hibernatemode        3  
 autopoweroff         1  
 ttyskeepawake        1  
 displaysleep         0  
 acwake               0  
 lidwake              1  

Software OS X 10.9.2 (13C64)
13-inch, Mid 2012

Best Answer

The default sleep mode used by Mac laptops is a hybrid between traditional sleep mode (suspend to RAM) and hibernation (suspend to disk): the contents of the RAM are saved to the disk, but the RAM is kept powered as well. Desktop Macs use traditional sleep mode (suspend to RAM) by default.

See man pmset:

SAFE SLEEP ARGUMENTS
     hibernatemode takes a bitfield argument defining SafeSleep behavior.
     Passing 0 disables SafeSleep altogether, forcing the computer into a reg-
     ular sleep.

     0000 0001 (bit 0) enables hibernation; causes OS X to write memory state
     to hibernation image at sleep time. On wake (without bit 1 set) OS X will
     resume from the hibernation image. Bit 0 set (without bit 1 set) causes
     OS X to write memory state and immediately hibernate at sleep time.

     0000 0010 (bit 1), in conjunction with bit 0, causes OS X to maintain
     system state in memory and leave system power on until battery level
     drops below a near empty threshold (This enables quicker wakeup from mem-
     ory while battery power is available). Upon nearly emptying the battery,
     OS X shuts off all system power and hibernates; on wake the system will
     resume from hibernation image, not from memory.

     0000 1000 (bit 3) encourages the dynamic pager to page out inactive pages
     prior to hibernation, for a smaller memory footprint.

     0001 0000 (bit 4) encourages the dynamic pager to page out more aggres-
     sively prior to hibernation, for a smaller memory footprint.
     hibernatemode = 0 (binary 0000) by default on supported desktops. The
     system will not back memory up to persistent storage. The system must
     wake from the contents of memory; the system will lose context on power
     loss. This is, historically, plain old sleep.

     hibernatemode = 3 (binary 0011) by default on supported portables. The
     system will store a copy of memory to persistent storage (the disk), and
     will power memory during sleep. The system will wake from memory, unless
     a power loss forces it to restore from disk image.

     hibernatemode = 25 (binary 0001 1001) 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.

To make a laptop or a desktop Mac always hibernate (suspend to disk), run:

sudo pmset -a hibernatemode 25

To make a laptop always hibernate on battery power, run:

sudo pmset -b hibernatemode 25

Setting hibernatemode to 25 decreases energy consumption during sleep but makes waking up take longer.

Some new Macs automatically enter a standby mode after a specific amount of time of being in regular sleep mode under certain conditions. See http://support.apple.com/kb/HT4392 (Mac computers: About standby mode):

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.

man pmset:

STANDBY ARGUMENTS
     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 hiberna-
     tion image to disk and powering off memory for Standby.

sudo pmset -c standbymode 1 would enable standby mode even when not on battery power. sudo pmset -a standbydelay 1800 would change the delay before entering standby mode to 30 minutes.

Some Macs also hibernate after four hours of normal sleep under certain conditions. See 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.

man pmset:

autopoweroff - Where supported, enabled per default as an implementation
of Lot 6 to the European Energy-related Products Directive. After sleep-
ing 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 net-
work access is enabled.
autopoweroffdelay - delay before entering autopoweroff mode. (Value =
integer, in minutes)

I don't know if there is any difference between the hibernation mode that is used when hibernatemode is set to 25, standby mode, and the hibernation mode that is used when autopoweroff is enabled.

Standby mode or hibernation does not save that much energy though. According to Apple's environmental report, the current 13-inch MacBook Air consumes 0.25W when it is turned off and 0.68W when it is in sleep mode on 230V voltage. The MacBook Air has a 54-watt-hour battery, so a full battery should last about three days when in sleep mode (if the Mac does not enter standby mode) and about nine days if the Mac is turned off. The energy consumption in hibernation or standby mode is probably close to the energy consumption when the Mac is turned off.