I was recently gifted a new iMac for my birthday and it came with Mavericks which I was able to upgrade to Yosemite quite easily. One thing I really missed from my days of using windows was the Hibernate feature. I would always hibernate my machine rather than shutdown. The main reason was that the boot up was comparatively faster and all my applications were already running.
OSx does not have a similar option and the sleep mode meant that it was “always” powered on albeit using minimal power. Here’s how I changed my OSX to hibernate right away. Start a terminal window and
su -
<type the root password>
pmset -a hibernatemode 25
pmset -a standbydelay 1
<reboot iMac>
This now means when I click the sleep in the Apple menu, it will sleep for 1 second and then proceed to dump the system ram to disk and power off. Here is a copy of the man page for these commands.
SAFE SLEEP ARGUMENTS hibernatemode takes a bitfield argument defining SafeSleep behavior. Passing 0 disables SafeSleep altogether, forcing the computer into a regular sleep. 0000 0001 (bit 0) enables hibernation; causes OS X to write memory state to hibernation image at sleep time. On wake (without bit 1 set) OS X will resume from the hibernation image. Bit 0 set (without bit 1 set) causes OS X to write memory state and immediately hibernate at sleep time. 0000 0010 (bit 1), in conjunction with bit 0, causes OS X to maintain system state in memory and leave system power on until battery level drops below a near empty threshold (This enables quicker wakeup from memory while battery power is available). Upon nearly emptying the bat- tery, OS X shuts off all system power and hibernates; on wake the system will resume from hibernation image, not from memory. 0000 1000 (bit 3) encourages the dynamic pager to page out inactive pages prior to hibernation, for a smaller memory footprint. 0001 0000 (bit 4) encourages the dynamic pager to page out more aggres- sively prior to hibernation, for a smaller memory footprint. 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 any- thing 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 hibernate 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. Please note that hibernatefile may only point to a file located on the root volume.
STANDBY ARGUMENTS 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. standby only works if hibernation is turned on to hibernatemode 3 or 25. standbydelay specifies the delay, in seconds, before writing the hiber- nation image to disk and powering off memory for Standby.
Update 04/11/15: If you ever need to restore this back to the original settings, open System Preferences > Energy Saver and click “Restore to Defaults”. If the option is greyed out then you are already back to the original settings.
Hi, thanks for pulling this together as I still miss good old windows hibernate a lot. One question though: You write it works from the apple menu. What about the shortcuts (cmd+alt+eject) and closing the lid? Are these triggers configurable seperately?
LikeLike
Hi Stefan, I’ve not tried these two options. What did you notice when you tried it?
LikeLike
I have just switched to Mac from Windows as well and, was looking to enable hibernate feature.
Your article was very helpful but I was wondering, could the same effect (hibernate instead of sleep) be achieved by just using standbydelay 1 instead of default 10800 (in my case) where hibernatemode was set to 3 by default since I am using portable machine (Macbook)?
LikeLike
Hi Edis, it should work. Have you tried it?
LikeLike
Hello,
I set hibernation as you described but now I would like to set it back as I have it before (“factory settings”).
Unfortunately, opening System Preferences – Energy Saver and pressing Restore Defaults (and reseting iMac) doesn’t work =/, can you help me please?
Thank you very much.
LikeLike