All Articles

Hibernating in OSX Lion

In OSX Lion (might also be the case for older versions to), there is no direct way to hibernate a laptop except running out of battery power. The only available option is sleep, which will wake from memory; so it keeps draining the battery. It is possible to change this default behavior with the utility pmset.

From the man page:

We do not recommend modifying hibernation settings. Any changes you make are not supported. If you choose to do so anyway, we recommend
using one of these three settings. For your sake and mine, please don't use anything other 0, 3, or 25.

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.

So by default, the system uses hibernatemode=3. All we need to do it change it to 25 and the sleep function will hibernate the computer:

sudo pmset hibernatemode 25

Don’t forget to change it back to 3 to get the default behavior back.

Published Sep 22, 2011

I am a computer scientist specializing in building machine learning powered products. I’m currently a machine learning developer at Local Logic.

1 thoughts on "Hibernating in OSX Lion"

Clément Malliet

Commented 2012-07-23 01:40:58

Merci pour l'astuce, ma batterie est complètement morte, et ne pas pouvoir faire de veille me manque terriblement. Espérons que ça marche.

Clément, ton neveu.