How to add hibernate mode to MacBook Pro

Solution 1:

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.

Solution 2:

I think you are trying to find out what is draining the battery during the sleep.

Macs are designed to use the sleep time to do some house cleaning and chores.

The first 4 hours

autopoweroffdelay 14400 seconds

it will do nothing (energy saving regulations EC), then it will wake up to do its stuff.

But based on this study under "normal" conditions draining about 350mAh/8 hours a fully charged battery with 7000mAh capacity should last up to 7 days in sleep mode.

Battery drain

There are many 3d party apps that "manage" the sleep mode, but my answer is focusing on finding out what is draining your battery.

Safe Sleep for example means it will save the RAM information to the disk (safe) while the RAM stays fully powered, and it does not stop it from performing maintenance tasks and others.

I know I am not giving you sleep modes, but trying to explain that you need to find out why is your computer draining so much during sleep.

What I recommended to do is to find what is going on, (what is your Mac dream off during the sleep).

For example this in Terminal will tell you the wake reasons

syslog |grep -i "Wake reason"

For details use pmset -g log in Terminal.

Then look and the nightly hours (during the Sleep) to see what is really going on and who is active.

For example you have the

ttyskeepawake

set to ON.

If you are not using the remote wake then disable it in Network setting or use this in Terminal to disable it pmset ttyskeepawake 0

Here is some more detailed information.

Solution 3:

MacBook Air can easily last up to 30 days (I believe it's close to 25-28 days) in stand-by/hibernation, not sure where the 3 and 9 days come from.