Is your Mac taking too long to wake from sleep? Or do you have a MacBook Air with a small drive and you need all the storage space you can get? Leopard & Snow Leopard now save the contents of your RAM to disk before sleeping so if your computer loses power, you won’t lose the contents of memory. Here’s how to change it:
sudo pmset -a hibernatemode 0
sudo pmset -a hibernatemode 1
sudo pmset -a hibernatemode 3
“0” is traditional sleep: the contents of memory will not be saved to disk, and power will continue flowing to your RAM, to maintain what’s in it when you wake up. If your computer loses power or your battery dies, you will lose all unsaved changes and you will have to re-boot your Mac.
“1” is hibernate mode: Memory will be saved to disk and power will NOT continue flowing to your RAM. This will take even longer to sleep and wake but your computer will use even less power when asleep. Note that the sleep image file on your hard drive will be as large as your installed RAM: if you have 4 GB of RAM, thats 4GB saved to your disk. That’s a lot if you have only a 64GB SSD.
“3” is now the default for laptops: this will keep power flowing to your RAM, and save the contents of memory to disk in case your power goes out.
After changing this setting (at your own risk! Don’t blame me if you lose unsaved changes when your battery dies!) You should delete the sleep image to reclaim that hard drive space. Delete /var/vm/sleepimage as an administrator and you’re done.
There are even more tricks you can apply if you read the man page for the pmsetcommand, for example, this setting can be configured differently if you are on a power supply or battery, and automatically switch, or you can disable sleep if a remote process is logged in, like screen sharing or ssh. Cool.