Tuesday, September 25, 2012

Instant sleep on MacBook - no sleepimage

Apple really cares about the content of my Macbook RAM. But I don't - I'd prefer to have that extra 2-3 minutes back when closing the lid.
The good news: You can customize the sleep mode on your Macbook so it does not save the content of your memory to the disk before sleeping.

When you put a Macbook into sleep, by default, it will page out your memory to the disk (/var/vm/sleepimage) - in case the battery gets depleted you still have your work saved. This is called hibernatemode 3:


 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.


The issue is that if you have a lot of memory (8-16Gb), it takes a good while to swap it out and isn't particularly useful for storing on a small SSD drive or in fact extending the life of the drive itself.

To turn it off, simply use


sudo pmset hibernatemode 0

If you want to revert it back to the default setting, use

sudo pmset hibernatemode 3


For more info on pmset, visit the man page on Apple developer site.

No comments:

Post a Comment