The cure for a hungry, sleepy laptop
- TAGS:laptop, Mac OS X, MacBook Pro, sleepimage, Terminal
- IT TOPICS:Hardware, Macintosh & Apple, Software, Storage
When I started using a MacBook Pro last summer, I found two features to dislike. One was the hard drive space — or the lack thereof. 120 GB was a big improvement over my older PowerBook's 80 GB, but faced with my growing movie, photo, and music collection, it still wasn't enough. I offload as much ancillary data as I can to external hard drives, but those volumes aren't subjected to the daily backups that the laptop's internal drive is, so I'm eager to locally retain as much data as possible. I should've purchased the computer with a customized, larger, inbuilt drive, as I suspect it would now be more expensive to make such a modification post-purchase. Live and learn.
The other feature that confounded me was how lazily the MacBook Pro went to sleep. If I closed the lid and then immediately had to reawaken it for a previously forgotten task, I'd have to wait 20-30 seconds before it would wake. Why the machine was comatose for that time, I didn't know. Other Mac users suggested I'd gotten a lemon; I decided it was a lesson in patience. Little did I suspect this issue was connected to my ever-shrinking free hard drive space.
When I recently spied a full volume in my computer's near future, I took to doing some spring cleaning. My inspection began with WhatSize, a utility that maps a directory tree of which files and folders are consuming the most bits. iTunes, Juiced.GS back issues — these were the usual suspects. But this time, I found something I'd never noticed before: a single file, weighing in at more than 2 GB, and found at the path /Volumes/Macintosh HD/private/var/vm/sleepimage.
A quick Google search informed me of the purpose of this file: when my MacBook Pro goes to sleep, those 20 seconds of limbo are spent creating an image of my RAM. The laptop's battery preserves the state of the physical RAM, but should the battery die (or be removed) and the RAM erased, the sleepimage file functions as a backup, allowing the RAM's contents to be restored once power is.
A great safety feature — but one I'm unlikely to use, as I have only one battery, and the most travelling my computer does is from outlet to outlet. And since the sleepimage file is at least as big as the machine's installed RAM — in my case, two gigabytes — I'd be better off without it. The Web site Mac OS X Hints therefore offers these two commands which, when typed into the Terminal, will disable the creation of the sleepimage file:
sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false
I could then safely delete my boot volume's existing sleepimage with this Terminal command:
sudo rm /private/var/vm/sleepimage
A quick reboot to ensure the above settings have taken effect, and poof: I had an easy-to-sleep MacBook and at least as much reclaimed hard drive space as I have RAM. Should I ever need the safe sleep feature re-enabled, the above page also offers instructions for reversing the procedure.
Tony Diaz contributed to this post.




