Jump to content

[How to]Set Sleep mode


  • Please log in to reply
1 reply to this topic

#1
HUSABER

HUSABER

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 938 posts
  • Gender:Male
  • Location:Cyprus
  • Interests:HusabergFC-600 FourStroke,KTM500 TwoStroke,TM300 TwoStroke
    Free Time-My Hackintosh&Ap...

Set Macs' sleep mode
Check the current setup
After you launch Terminal, the first step is to determine which sleep mode your Mac is currently using (in case you wish to go back to it). You can both view and change the sleep mode using the Unix program pmset. To see your current settings, type pmset -g | grep hibernatemode. You should see something like this:
$ pmset -g | grep hibernatemode

hibernatemode 3


Great, so your machine is using mode 3, whatever that might be. Well, thanks to the documentation for the handy Deep Sleep Dashboard widget, which puts your machine immediately into hibernation mode (so you don’t have to yank all the power sources to invoke it), we can tell exactly which mode is which:
0 - Old style sleep mode, with RAM powered on while sleeping, safe sleep disabled, and super-fast wake.


1 - Hibernation mode, with RAM contents written to disk, system totally shut down while “sleeping,” and slower wake up, due to reading the contents of RAM off the hard drive.


3 - The default mode on machines introduced since about fall 2005. RAM is powered on while sleeping, but RAM contents are also written to disk before sleeping. In the event of total power loss, the system enters hibernation mode automatically.


5 - This is the same as mode 1, but it’s for those using secure virtual memory (in System Preferences -> Security).


7 - This is the same as mode 3, but it’s for those using secure virtual memory.
Once you see which mode you’re presently using, make a note of it. You could do this in one step, actually, with a command like this:
sudo pmset -g | grep hibernatemode > ~/Desktop/current_mode.txt


That will take the output of the pmset command, strip out everything other than the hibernatemode value, and then dump the result into a file on your desktop named current_mode.txt. Save this file for future use.
Note: I’m being overly cautious here on purpose. The reality is that, unless you’ve messed with this setting before, your Mac will either be in mode 0 (in which case, this tip doesn’t matter, as your Mac is using old-style sleep), or mode 3 or 7 (the default for machines shipped since last fall). Saving a text file to remember a 3 or a 7 is really overdoing things, but at least you won’t be able to say you don’t remember which mode your machine was in.
Change the sleep mode setting

To change your sleep mode, you use pmset again, providing the variable and value you wish to assign. So to return to the old style sleep mode (which is mode 0 from the above list), enter this command:
sudo pmset -a hibernatemode 0
Press Return, and you’ll be asked for your password. Provide it, and your sleep mode has been changed. If you ever wish to go back to your previous setting, just repeat the above command, but replace 0 with the value from your current_mode.txt file.
And yes, this means you can also set your machine to always go directly into hibernation mode by running the above command with 1 at the end. I find it much simpler, though, to use the Deep Sleep widget linked above—and the widget also returns the hibernatemode setting to its prior value, which means that you can use the widget for hibernation, and still enter normal sleep mode when you simply close the lid.
Note that restarting is not required for these changes to take effect.
Recover some drive space

If your machine was previously set to mode 3 (or 7 ) and you’ve reverted to the old style sleep mode, you’ve got one more step to take: recover the drive space used up by the copy of your system’s RAM, which was created the last time you slept the machine prior to making the switch. In Terminal, enter these two commands, pressing Return after each and providing your password when asked:
cd /var/vm

sudo rm sleepimage


If you ever return to the new style sleep mode, the sleepimage file will be automatically recreated when you execute the sudo pmset command—yes, it creates the file as soon as you execute the command, not the first time you put the machine to sleep.
Wrap up
Personally, I find the new sleep mode a blessing, and I’ve left my machine in that mode. If you prefer the old behavior, however, now you know exactly how to get it back. Yes, it requires a trip into Terminal land, but it’s really not that hard to do once you’re there.
:wink2:



#2
p.H

p.H

    InsanelyMac Legend

  • FAQ Team
  • 767 posts
  • Gender:Male
  • Interests:Hackintosh & NBA & COD4 promod
impressive
I happened to use man command to finder the proper info about pmset
:) so it's kind of review somewhat





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy