Filed Under Apple on 2008-02-25, 08:41
I don’t like to waste battery life, especially when traveling. I love the Hibernate feature in Windows, and have all of my laptops set to hibernate when the lid is closed. The few extra seconds it takes to wake up is worth the saved battery life in my eyes. For those that don’t know here are the different states of the Macbook Pro:
- On – Computer is awake, screen is on, battery is being consumed based on your power settings
- Off – Computer is using no power from the battery
- Sleep – Computer has turned off the screen and has suspended the operating system to RAM (volatile memory).
- Hibernation – Computer has turned off most hardware and has suspended the operating system to the harddrive
Usually when you close the lid of your MBP, it will be put to sleep, and wake up quite quickly when you open the lid again. While it’s sleeping it’s still consuming battery power, albeit a small amount compared to normal usage. When the battery reaches a certain low level, the MBP will automatically switch to hibernation mode and basically shut off so you don’t lose any of your work. Sleep is great for when you’re actively using your computer, but when you want to stretch out battery life for as long as possible, you want to hibernate. Also to note is that it appears that the newer Macbook Pros also write information to the harddrive when sleeping so that when the battery drops to dangerous levels it can jump instantly into hibernation. Apple calls this “Safe Sleep”. (More info on all the technical stuff here)
A few examples of why you would want to hibernate with your laptop:
- You’re about to head to the airport on an international flight and you want to use your machine during the flight but still leave enough juice to be able to pull up a map/email/info when you get to your destination.
- You toss your laptop in a bag and may or may not use it on a weekend trip but don’t want to worry about charging it.
- You want to conserve every little bit of power you can.
And when you would want to stick with sleep:
- Your laptop isn’t running off battery power
- You will be opening and closing your lid quite often
- You’re running around but actively using your laptop (conferences, meetings, etc.)
Basically you sacrifice the speed of restoring your machine to gain a little bit of battery power or vice versa. Personally I like to get every last bit of electricity that I can.
After some searching I came across a post that explained how to basically force your MBP into hibernation when the lid is closed. It requires a quick bit of work in terminal, but is painfully simple.
In Terminal/iTerm/etc run the following command to determine your current sleep mode:
pmset -g | grep hibernate
This should return one of the following:
- 0 – Legacy sleep mode. It will save everything to RAM upon sleeping but does not support “Safe Sleep”. Very fast sleep.
- 1 – Legacy “Safe Sleep”. This is the “Safe Sleep”. Everything your laptop goes into sleep, it will save everything to harddisk. Slow on Sleep and Startup.
- 3 – Default. As described above, when sleeping, contents are saved to RAM. When battery runs out, hibernate occurs.
- 5 – Behaves as 1 but applicable only for modern Mac that uses “Secure virtual memory”.
- 7 – Behaves as 3 but applicable only for modern Mac that uses “Secure virtual memory”.
Now edit and save your /Users/username/.bash_profile file with the following lines:
alias hibernateon="sudo pmset -a hibernatemode 5"
alias hibernateoff="sudo pmset -a hibernatemode 0"
hibernateon and hibernateoff can be any text you want, you just need to remember what you used
Execute the following:
Now you have a handy little command that will let you enable and disable instant hibernation on a whim. Whenever you want your machine to hibernate when you close the lid, just drop to a terminal window and type “hibernateon”. When you’d prefer your laptop to just sleep, type “hibernateoff”.