How to master hibernatemode on your mac
by Sébastian Le Merdy
Do you know that you can turn your mac into hibernation mode whenever you want ? Not after it runs out of battery power. With this blog entry I will describe how do I used to do this until Snow Leopard and how do I do it now with Mountain Lion.
But after upgrading to Mountain Lion, this piece of software doesn’t works anymore. This is an open source tool. As a result, source code is freely available to watch (and to contribute). We can see that DeepSeep try to set hibernatemode setting of pmset utility to 0, 1, 3, 5 or 7.
man pmset, only 0, 3 or 25 value is relevant :
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, his- torically, plain old sleep. hibernatemode = 3 (binary 0011) by default on supported portables. The system will store a copy of memory to persis- tent 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 "hiberna- tion" - slower sleeps, slower wakes, and better battery life, you should use this setting.
Here is my solution : edit
~/.bash_profile to add this functions and replace
** by your account password :
Start a new Terminal or
source ~/.bash_profile. As this file will now contains your account password then
chmod go-rwx it. Now to know on which hibernatemode my machine is, I just have to type
To switch to a given mode, type one of these commandstags: