Pick of the Week - Oct 6 [Show all picks]
MercuryMover 2 - Keyboard-based window management
Submit HintSearchThe ForumsLinksStatsPollsFAQHeadlinesRSS 10,000+ hints and counting!
10.4: Disable Safe Sleep for faster sleep on lid close
Laptop Macs
Newer portable Macs use safe sleep (hibernation) in combination with normal sleep (older computers can use this, too). What happens is that when you put your computer to sleep, the system writes the contents of RAM into the file /private var vm sleepimage, then goes into normal sleep mode. If your system loses power completely, it can recover the contents of RAM from this sleepimage file.

The problem with this is putting your computer to sleep can take a while (20 seconds to one minute or more), depending on how much data you currently have loaded in RAM. Also, this sleepimage file is the same size of your total RAM, wasting valuable hard drive space. I have 2GB of RAM, so my file is 2GB.

To disable safe sleep, run the two following commands in Terminal:
$ sudo pmset -a hibernatemode 0
$ sudo nvram "use-nvramrc?"=false
When done, restart your computer. Now go delete the file /private var vm sleepimage" to free up some hard drive space. When you put your computer to sleep it, should happen in under five seconds; my MacBook now goes to sleep in two seconds.

[robg adds: To state the obvious, with safe sleep disabled, a total power loss will wipe out whatever was open on your machine. To enable safe sleep mode again, repeat the above commands, but change hibernatemode 0 on the first line to hibernatemode 3, and =false to =true on the second line. You'll then need to reboot again. Personally, I prefer the safe sleep mode, even with the slower sleep time and hard drive consumption -- even if for no other reason than it's great when changing batteries on a flight.]
    •     [69,089 views]   
Rate this hint: [ 1  · 2  · 3  · 4  · 5 ] Average rating:

Hint Options

10.4: Disable Safe Sleep for faster sleep on lid close | 22 comments | Create New Account
Click here to return to the '10.4: Disable Safe Sleep for faster sleep on lid close' hint
The following comments are owned by the person who posted them. This site is not responsible for what they say.
What about this tip from Apple?
By: Dirk! on Tue, Mar 6 2007 at 8:01AM PST
Hello,

Apple has a tip about putting your computer into sleep mode very fast:

http://www.apple.com/pro/tips/quicksleep.html

"Just press Command-Option and then hold the Eject button for about 2 seconds and Zzzzzzzzzzzzzz. It doesn’t get much faster than that."

Does that mean, this key combination puts you MacBook into sleep instead of deep sleep?
What I really want is :
By: donaciano on Tue, Mar 6 2007 at 9:39AM PST
To have safe-sleep turned off by default, so that it doesn't waste part of my battery everytime I close the lid, and also be able to enable it once for the next sleep when I need it. Perhaps a command run from the terminal, or holding down option when pressing Sleep on the Shut Down prompt.

Or even a setting in system prefs to only use safe-sleep when the battery has less than a certain % left. Extra cautious folks could crank the number up to 100%, and I'd leave it around 10%.

Either of these would be fine. :)
10.4: Disable Safe Sleep for faster sleep on lid close
By: barefootguru on Tue, Mar 6 2007 at 10:33AM PST
What the reasoning for the nvram command? I disabled my safe sleep purely with the first pmset line.

I disabled mine because safe sleep writes the entire contents of RAM to disk *unencrypted* -- even if you use FileVault and/or encrypted swap. There's been reports around the web of people finding their password in the safe sleep file.
10.4: Disable Safe Sleep for faster sleep on lid close
By: etresoft on Tue, Mar 6 2007 at 11:42AM PST
I tend to forget these little tricks when I need them. I can see the rationale for having and not having the hibernate mode. I think we should be able to choose when appropriate. Here is a virtually untested script:
#!/bin/sh

SETTING=$1

if [ "$SETTING" == "off" ]; then
  echo "Turning off safe sleep"
  sudo pmset -a hibernatemode 0
  sudo nvram "use-nvramrc?"=false
  echo "Don't forget to reboot!"
  echo You are now free to remove your sleepimage file at /private/var/vm/sleepimage
elif [ "$SETTING" == "on" ]; then
  echo "Turning on safe sleep"
  sudo pmset -a hibernatemode 3
  sudo nvram "use-nvramrc?"=true
  echo "Don't forget to reboot!"
else
  echo "Usage: safesleep on | off"
fi
If you care about your privacy, don't use Safe Sleep
By: lincd0 on Tue, Mar 6 2007 at 5:30PM PST
Disabling Safe Sleep should be the first thing you do on any new Mac. It writes your passwords and everything else in memory out to disk in the clear, where they're trivial to recover. It's appalling that Apple enables this by default and doesn't give naive users any warning of the risk, even when they turn on FileVault. Safe Sleep completely negates the effect of FileVault and most other forms of encryption.
10.4: Disable Safe Sleep for faster sleep on lid close
By: 93 Escort Wagon on Tue, Mar 6 2007 at 11:15PM PST
Hmm... I disabled safe sleep about a month after I bought my Macbook Pro. However I did not run the second command (nvram ...), just the first one (pmset ...). My laptop is obviously not going into safe sleep - what does that second line do, exactly?
10.4: Disable Safe Sleep for faster sleep on lid close
By: dadaDaveed on Wed, Mar 7 2007 at 9:25AM PST
This tip doesn't work on my MacBook for some reason. After entering both strings successfully and rebooting, it still takes 20-30 seconds to sleep. Any idea what would cause these commands to not work? (I'm running a Black MacBook with 2Gb RAM)
10.4: Disable Safe Sleep for faster sleep on lid close
By: FJModrego on Fri, Mar 9 2007 at 4:56AM PST
May be I am wrong (I have not tried it as yet) but I think that you can do all of this with the widget Deep Sleep which was the pick of the week on Oct 16, last year http://www.macosxhints.com/article.php?story=20061018014009924
10.4: Disable Safe Sleep for faster sleep on lid close
By: smactron on Sun, Apr 1 2007 at 11:19PM PDT
How do I delete "/private var vm sleepimage"?
10.5: Disable Safe Sleep for faster sleep on lid close
By: spamathon on Wed, Jan 2 2008 at 2:29PM PST
This also works on 10.5 but with a caveat (that may well have been in place in 10.4, I just didn't figure it out until now).

Be aware that *any* changes you make with pmset change your active profile to 'Custom'. That means if you follow the above tip by setting hibernatemode to 0 your active profile switches to 'Custom'. Then if you switch back to one of the default Energy Saver profiles (Better Energy Savings, Normal, or Better Performance) hibernatemode is set to its value for that profile, which is 3 and will always be 3, apparently. The defaults cannot be changed.

So to take advantage of this tip permanently, your Energy Saver profile must always be set to 'Custom'.

Bit of a PITA really...
Copyright © 2008 Mac Publishing LLC (Privacy PolicyContact Us
All trademarks and copyrights on this page are owned by their respective owners.

Visit other IDG sites:


Powered By Geeklog Created this page in 0.17 seconds