Tuesday, June 3, 2008

TechTelic Tip: Make you computer sleep more quickly


When you shut the lid of a mac notebook, the display immediately turns off, but the computer does not instantly go to sleep. This is because the machine is preparing for what's called "safe sleep." 

Safe sleep allows you to switch out to a spare battery while the machine is asleep without having to shut down or lose your place in whatever you're doing. The way this works is, when a computer goes to sleep, it powers down everything except for the RAM. 

The RAM holds information about anything and everything currently running on your machine so that when you wake it back up, you can continue right back where you left off. The RAM doesn't take much energy to run, but requires battery power to remember what was running when it was put to sleep. 

The difference with safe sleep is that the computer first writes the contents of your RAM onto the hard drive, which does not require power to store data. The problem this causes is that your machine can take up to 30 seconds to go to sleep during this process, and if during this time you throw the machine into your backpack or laptop case, you can rattle the (still running) hard drive enough to crash it. I made it a habit to wait until I saw the sleep light going on and off before putting the machine away so as to avoid causing damage to the hard drive, but because I don't even own a spare battery, safe sleep is not necessary for me. 

To avoid having to wait the half a minute or so that it takes to put the machine into safe sleep, there is a terminal command to disable the feature.

$ sudo pmset -a hibernatemode 0
$ sudo nvram "use-nvramrc?"=false

Once those commands have been issued, you will need to reboot your machine for the new commands to take effect.  Once that's done, you will notice that your machine sleeps significantly more quickly.  However, if you experience a power loss, whatever you were working on will be erased.  If you do decide you need safe sleep back again, you can issue these commands to reverse it.

$ sudo pmset -a hibernatemode 3
$ sudo nvram "use-nvramrc?"=true



No comments: