Favorite Mac Hacks: Remove huge sleepimage cache file

When recent Macs sleep, they cache the contents of RAM in a huge file on the boot drive. The file is as big as your RAM plus 750MB. If you're in a situation where you need every ounce of performance/space and don't need to sleep, deleting this file can make a difference. For example, recording studios often set their production Macs to never sleep.

In my test, deleting my file freed up 2GB of space, and the file wasn't recreated by the OS until later. (Although my 2GB of RAM only caused a 2GB cache file, not 2GB+750MB, that's still a lot of drive space.)

To delete it, first check your drive's free space. Then, fire up Terminal (careful if you've never used Terminal, you can easily whack your system) and go to the correct directory with this command:

cd /var/vm

Then, check the contents of the directory:

ls -l

If sleepimage isn't there, nevermind this whole shenanigan, you've got an older Mac (or you hacked the sleep mode, see below). If it is there, delete the sleepimage file: