Hibernating Mac OS X on MacBook Pro
Operating systems (Windows included) tend to keep the hibernation option quite hidden from user’s eyes. I really don’t know why. It could be because it would be harder for a begginer to grasp the difference between sleep mode and hibernate mode, thus risking data loss and frustration during the lengthier process of going into and out of hibernation.
Nevertheless, on a laptop, I strongly believe that hibernation is a must. Basically, when choosing between sleep and hibernation it’s like choosing between sacrificing the speed of restoring your machine to gain a little more battery life and the other way around.
By default, MacBook Pros know how to enter only sleep mode when you close the lid, which is pretty cool if you like to brag about how fast your laptop “comes back to life” right after you raise the lid again. But you still lose battery power during sleep mode and when you’re on the run this might be far from ideal. The only time a MacBook Pro will hibernate is when it will drastically run out of battery, and this mode is called “safe sleep” and it’s completely automatic.
To determine the current mode for your machine, type the following in a Terminal:
AndreiMac:~ andrei$ pmset -g | grep hibernate
hibernatefile /var/vm/sleepimage
hibernatemode 1
The possible values you can see here are the following:
- 0 - Legacy sleep mode. Saves everything to RAM, very fast sleep, but without the “safe sleep” option if it runs out of battery. Careful with this one.
- 1 - (mine, as above) Saves RAM contents to disk, equivalent of “safe sleep”. Basically, old-school hibernation that doesn’t drain any battery. Slow on sleep and wake up.
- 3 - Just like “legacy sleep” mode, but with “safe sleep” enabled, so it enters RAM sleep mode but hibernates when it runs out of battery. This should be your default options if you haven’t changed it before.
- 5 - Similar to 1, but only if you enable “Secure virtual memory” in System Preferences
- 7 - Similar to 3, but only if you enable “Secure virtual memory” in System Preferences
To change your current sleep mode, use the following command:
sudo pmset -a hibernatemode 1
To make this process faster, define two aliases:
alias hibernate_on="sudo pmset -a hibernatemode 1"
alias hibernate_off="sudo pmset -a hibernatemode 3"
Add these lines to your /Users/<username>/.bash_profile file and run
source .bash_profile
That’s it. Now you can decide how your laptop will go to sleep.
Recent Comments