13

My MacBook Pro takes an awful long time to go to sleep when I close the lid. Considering that I generally want to close the lid and then carry it somewhere, I want it to be fully asleep so I don't have any hard drive issues. Is there anything I can do to speed up the process?

9

I recommend a nifty little utility called SmartSleep that allows you to control when the saving of your RAM contents to disk for the Safe Sleep / Hibernate feature Mac OS X has.

Alternatively you can disable Safe Sleep altogether by running: sudo pmset -a hibernatemode 0. To change it back to the defaults, change the value to 3.

0 - Old style - just goes to sleep.
1 - Only Hibernate
3 - Default - goes to sleep but writes RAM contents to disk just in case.
5 - Only Hibernate mode but if you use secure virtual memory.
7 - The Default but if you use secure virtual memory.
4

Use the command pmset -g log to find out what is delaying the sleep command. Look for "applicationresponse.slowresponse" and "applicationresponse.timedout" entries.

2

Another use for the pmset utility (which, like most Apple utilities, is documented: do "man pmset" in Terminal) is to tell the system to sleep when you hit the power button. In Terminal, do

sudo pmset powerbutton 1

and thereafter when you hit the power button a menu comes up with choices Restart, Sleep, Cancel, and Shut Down. I always sleep my MacBook Pro this way in order to be sure it has really gone dormant.

On the other end of the sleep cycle, I don't want the machine waking up while traveling if it gets jostled enough to shake the lid open (even briefly). The Terminal command to estabish this is

sudo pmset -a lidwake 0

For both commands, you will have to authenticate as an administrator.

2

Depending on what applications you are running it could take a significant amount of time (20-30 sec) to actually "sleep."

OS X will "dock" the hard drive head if it detects sudden movement, so I wouldn't expect any issues there.

  • Two days ago my sleep time was only maybe 3 seconds. Now it is 20-30 seconds. Is there a way to go back to that? Could it have something to do with launchd/httpd stuff that I changed? – Jared Updike Dec 8 '10 at 16:30
  • I have no idea. One way would be to check running processes / disk activity before attempting to sleep and then checking how long it takes to sleep. – Josh K Dec 8 '10 at 16:45
  • Thanks. Using Console.app I saw lots of error messages related to nginx -- I had a misbehaved nginx (web server) launchd configuration that kept getting relaunched every thirty seconds. I uninstalled nginx (since it wasn't working anyway) and used launchctl list/stop/remove to get it out of launchd and now sleep is back to taking seconds (the backlit keyboard turns off when I hit sleep, instead of before where there was a thirty second delay). Hopefully this info (not nginx per se, but the fact a rogue launchd or other program can cause sleep issues) is useful to someone else out there. – Jared Updike Dec 8 '10 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .