Red Green Repeat Adventures of a Spec Driven Junkie

Hibernate Macs Better

Quick Summary

To set Mac to maximize battery while maintaining the current system state: open a terminal and type:

$ sudo pmset -a hibernatemode 25

This save the current system state to disk and power off all components. When waking up, it will take a little longer than normal to wake up, but the system state will remain the same.

Motivation

Putting a MacBook to sleep is as easy as closing its lid and waking it up is just opening the lid.

I love this feature and leave my system running all the time without restarting. As macOS is BSD based, it’s a solid operating system.

I have a MacBook Pro that I use occasionally, but I do not leave it plugged in. The problem is, everytime I want to use it, there’s no power, because the sleep mode has used up all the battery.

I found from this article there is another setting in macOS that allows a Mac to be in a sleep mode that does not use any power, but can still power up a computer back to it’s previous state within a minute.

Requirements

  • a Mac computer, I am using a MacBook Pro 15” Late 2011 with Mavericks (OS X 10.9)
  • for fastests wake up experience: SSD

Hibernation Modes

Mac computers have different two sleep modes: sleep & hibernate.

They are similar in both restores the system state but the difference is how much fast restoration is and the amount power used.

Sleep

This mode allows the system to wake up quickly while using less energy than keeping the computer running. The system uses RAM memory to maintain the state, which is the only component powered on during sleep.

Hibernate

The system uses the hard drive to maintain the state. Before powering off, the system writes the contents of RAM to the hard drive and on restore, the system loads the RAM contents from the hard drive.

The result of hibernation is the same as sleeping, except it takes longer.

The difference between hibernation and sleep is the amount of power used in the state. Hibernation uses no power, sleep uses just enough power to keep the RAM powered.

Viewing Current Setting

The following command lists the current hibernatemode setting:

$ pmset -g | grep hibernatemode

Valid values:

  • 0 - only component powered is RAM. This is the default for desktop Macs.
  • 3 - like 0, but RAM contents are also written to disk. If there is power loss, the system will restore RAM contents from disk. This is the default for portable Macs.
  • 25 - power off RAM and CPU, write RAM contents to disk. The system will restore from disk.

source

Changing Hibernation Setting

The following command changes the hibernation setting:

$ sudo pmset -a hibernatemode <hibernate value>
  • sudo: super user do function, required as the command requires super user level privlidges.
  • pmset: the power management setting function
  • -a: set for all settings, other settings:
    • -b for battery
    • -c for charging
    • -u for UPS
  • hibernatemode: the option to control hibernation modes
  • <hibernate value>: valid hibernatemode values: 0, 3, or 25.

Conclusion

The default sleep option for a Mac is good, allowing power savings and quick wake up.

If one desires greater power savings at the expense of longer wake up time, setting a hibernatemode of 25 is perfect. To enable this setting, enter a command in the Terminal to set this.