Hibernation (audrith) Mac OS

So you've got your the new OS X Lion and you are using a Macbook pro or Macbook Air?

We all know that one of the more important features of a laptop is its battery capacity, it makes no sense to have a laptop that only last for an hour on batteries, another important thing now a days, is that we all want our laptops to be 'always on' I mean, like our phones, always in standby just like an iPad.

And, as you may have notice this are opposite features, if you have it always on you will loose battery and if you save battery, it will not wake up as fast as you may want it to do it.

Now, let's understand a little bit the differences between sleep and hibernate:

Sleep mode

Download

In sleep mode the computer tries to cut the energy from all computer's components like hard disks, display and others, and only keeps the power to the RAM, as there is where the current settings are stored.

Technically when waking from hibernate mode the system should allow you to authenticate and then load the contents of the hibernation file, but if a bug prevents this from happening, then your Mac may not be able to load the hibernation file, and could hang. To hopefully overcome this, first try disabling your full-disk encryption routines. When Apple announced new PowerBooks in October 2005, it also introduced Safe Sleep to Mac OS X, an extension to Sleep mode that allows for hibernation without power. Enabling Safe Sleep on your Mac.

In this mode the wake up time is really short (just a pair of seconds) but the power is still draining as RAM is working.

Hibernate mode

In this mode, the operating system is going to copy the RAM contents to the hard disk, and will shut the computer off, when you want it to wake up, it will boot from this image saved on the disk, and will restore the computer the last state it has before going to hibernate.

Enough, let's now see how we can be sure we have the best of both worlds with our Macbook.

Let's see the current state of the power management settings.

You should see something like this:

There are three parameters that we want to check here:

From the man page:

hibernatemode takes a bitfield argument defining SafeSleep behavior. Passing 0 disables SafeSleep altogether, forcing the computer into a regular sleep.

standby causes kernel power management to automatically hibernate a machine after it has slept for a specified time period. This saves power while asleep. This setting defaults to ON for supported hardware. The setting standby will be visible in pmset -g if the feature is supported on this machine.

And:

standbydelay specifies the delay, in seconds, before writing the hibernation image to disk and powering off memory for Standby.

With hibernatemode in '3' we have the default settings, which means that the computer will use sleep and not hibernate, as the default when the lid is closed, but because standby is set to ON, the computer will wait standbydelay seconds, before switching from sleep to hibernate

As you can see this is great, as you can now close the lid of your laptop, and you have n seconds to go back to it, and still have a fast 'boot' time, but if you stay away more than that, it will go into hibernate mode, and will save your battery.

You can change the time you want your laptop to wait before going into hibernate mode with this command:

Change 1200 to the number of seconds you want it to wait in sleep mode before going to hibernate mode.

If you need to set you laptop in sleep mode and turn on the standby mode (They should be on, as those are the default), enter these commands.

and:

With those settings, I have a laptop that waits for me in sleep mode for 30 minutes, after that, it better goes to hibernate as it may take longer for me to return to work :).

Mac Os Catalina

One last note:

Hibernation (audrith) Mac Os Download

If you forget to close the lid, the sleep parameter will dictate when your computer is going to go to sleep, that setting is in minutes, so in my case it will wait for 10 minutes on, and then if there is no activity on the keyboard or mouse, it will go to sleep for 30 minutes and finally to hibernate.

I have installed Windows7 by bootcamp on my Macbook, however, every time when I want to switch to Windows, I have to reboot the machine completely. That means I cannot keep my current workspace when next time I switch back to OSX.

If you use the Mac's hibernate function by the terminal, you don't even have the chance to choose which system to boot from, it immediately wakes up OSX. Sometimes, that's really a pain.

Hibernation (audrith) Mac Os Download

Back to the days of Windows, we used the hibernate function to switch between systems without losing your current workspace. Is there an alternative way to achieve it on Mac?

Hibernation (audrith) Mac Os Catalina

PS:
I can not use a virtual machine solution, because it has some hardware disadvantages. Such as the development of Kinect can't work through VM environment.