OS X Change hibernatemode with pmset for Instant Wake from Sleep

Wednesday, January 16, 2013

The default hibernatemode on Apple laptops is 3 which does the following:

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 disk image.

Even with the APPLE SM256C SSD in the MacBook Air (13-inch Late 2010), there is mouse and keyboard lag on wake from sleep. There is even more lag with a spinning hard drive.

If your laptop is charged regularly, and you are not worried about it running out of power while sleeping off the charger, there is no reason to keep a copy of memory on the hard drive. So, to have instant wake from sleep change the hibernatemode to 0 which does the following:

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.

Change hibernatemode to 0

To see what your current hibernatemode is set to, run the following command:

pmset -g | grep hibernatemode

To change the hibernatemode for instant wake from sleep, run the following command:

pmset hibernatemode 0

This change will be persistent across reboots.

Remove /var/vm/sleepimage

hibernatefile is the pmset parameter that specifies where memory contents are written to disk. By default, the RAM contents are written to /var/vm/sleepimage, and to verify this, run the following command:

pmset -g | grep hibernatefile

With the change to hibernatemode 0, the RAM contents will no longer be written to disk and this file can be removed to reclaim as much disk space as you have memory; if you have 4 GB of memory, you will reclaim 4 GB of disk space when you remove /var/vm/sleepimage with the following command:

sudo rm -f /var/vm/sleepimage

comments powered by Disqus