10.4: Enable safe sleep on some older Macs

Nov 18, '05 06:32:00AM

Contributed by: kneeslasher

Tiger only hintAs soon as I heard about 'safe sleep' (which lets you replace a battery without a shut down, for instance) on the new PowerBooks, I wanted it. I have often been in the position where my 12" PowerBook G4 has run out of juice while hibernating (due to various reasons), and then I have lost all my open programs. Well it appears that safe sleep can be implemented on many Macs, as described in this excellent entry on Andrew Escobar's blog.

It works. I've tried it.

[robg adds: I tested this on my 12" PowerBook G4 (1.33GHz), and it worked -- on the second attempt. The first time I yanked the power and restored it, the machine just cold booted. But on the subsequent attempts, it worked as it should. Very cool! If you try this one yourself, please post your Mac model info and success/failure results in the comments.

It should be obvious, but I'll say it anyway: this is potentially quite dangerous! Andrew provides good recovery instructions, in case things go wrong. However, I would recommend having a current backup, just in case...

The above-linked article is very well done, with clear step-by-step directions and additional information. In the event that entry ever disappears, though, I thought I would at least provide the basic steps here; Read More to see them...

Please note, I do not recommend using the following information to implement safe sleep on your Mac -- use the above-linked directions instead, as they are much more thorough, and cover situations that I haven't documented! With that warning, here are the basic steps:

  1. Open Terminal, and type the following, pressing return after each line:
    sudo nvram nvramrc='" /" select-dev
    " msh" encode-string " has-safe-sleep" property
    unselect
    '
    
  2. Now type sudo nvram "use-nvramrc?"=true and press Return. You must now restart the Mac for the settings to take effect.

  3. After the restart, go back to the Terminal, and enable hibernation:
    sudo pmset -a hibernatemode 3
    If you use secure virtual memory, see the original instructions for different settings. This command should create a file named sleepimage in /var/vm.

  4. Verify that everything worked -- put the Mac to sleep as you usually do, wait a few seconds, then wake it up. Use Console to view the System log, and make sure you see an entry that contains System SafeSleep.

  5. Test Safe Sleep -- sleep the machine, wait a bit, then disconnect all power sources. Plug in the power sources again, and watch the new "wake from gray" sequence.
That should do it ... and this nifty trick will save a few minutes during battery changeovers on those long flights!

Comments (42)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051114072358161