How to make a Mac hibernate (properly and consistently)

I’ve been a Mac user since 2002 and have no real plans to change anytime soon.

I occasionally find myself romanticising the idea of using Linux exclusively, and have made numerous attempts over the years only to find myself back at my OS X desktop.

I’m currently using a 2014 MacBook Pro 15″ with Retina display. It’s a nice machine that does everything I need. Except, that is, hibernate when I close the lid.

This is trivial to achieve in Windows or Linux, but rightly or wrongly (wrongly), not so easy to achieve in OS X.

There is a command-line tool called pmset that allows us to change the hibernate mode setting, but even this is not as straight-forward as it may seem.

There are a number of different settings we can manipulate with pmset, but the main one we’ll be looking at is what happens when the Mac sleeps.
One of pmset’s parameters is called hibernatemode, of which we can set to 0, 3 or 25 (There are others but they are outside the scope of this post).

hibernatemode 0: According to the pmset manpage, this is “plain old sleep”, meaning that the Mac will retain power to RAM upon system sleep. If power runs out while the machine is asleep, the contents of RAM will be lost.

hibernatemode 3: This is the default on portable Macs. In this mode the system will retain power to RAM and also write out the contents of RAM to disk. This means that the Mac can remain in standard sleep mode until the battery runs low and can then enter hibernate mode. Power is then removed from RAM, and the machine will page memory data into RAM from disk upon power-up.

hibernatemode 25: Upon sleep the system stores the contents of RAM to disk and removes all power (i.e. traditional hibernate).

So it would seem that hibernatemode 25 is what I’m looking for…

I ran the following command in a terminal to get this running how I want it:

sudo pmset -a hibernatemode 25

sudo because the command needs to be run with admin privileges, pmset to call the pmset utility, -a to apply the settings across all power profiles (AC power and battery) and hibernatemode 25 is the mode I want to use.

This appeared to work as expected, or so I thought. The Mac would go into hibernate mode when I closed the lid, and all seemed well. However, I noticed that if I left AC power connected and the Mac was hibernating for more than about 4 hours (say overnight), that it would enter a different hibernatemode that seemed to involve a full reboot.

So after a little further research, I found some other pmset argument that could be of interest.

The 2 that settings that allowed me to achieve proper hibernation were standby and autopoweroff.

standby (0 or 1) allows a Mac to enter a lower power state after a certain period of regular sleep. This is part of what is called “Safe Sleep” in OS X. You can specify the amount of time this takes with the sleepdelay argument.

autopoweroff is a little less clear. It seems to be similar in functionality to standby but will only come into affect if the Mac is connected to AC power.

I set both of these to 0 instead of 1, which disables both features.

So the full command to run to enable ‘proper’ hibernation becomes:

sudo pmset -a hibernatemode 25 standby 0 autopoweroff 0

My MacBook Pro now behaves exactly how I want. Sure, a GUI option would have been much quicker and easier, but where’s the fun in that?


    1. Ben Deegan Post

Leave a Reply

Your email address will not be published. Required fields are marked *