Twitter: calling home on account of it being mother's day
Subscribe via RSS or email  #3,978


How To: Quickly Sleep Your MacBook

Dec 06, 2007 in , ,

By default, recent Macs ship with their hibernate mode set such that when your Mac goes to sleep, contents of the RAM remain stored in the powered-on RAM in addition to written to the hard disk. The is called safe sleep mode because in the event that your computer loses power during sleep, the contents of the RAM can be read from the hard disk where they were dumped before sleep. This is why it is possible to change your battery while your MacBook is sleeping with this default sleep mode.

That’s all great but with more and more people using 2GB or more of RAM, it takes quite some time for the contents of the RAM to be written to disk and the laptop to begin sleeping. Why is this an issue? For me, I always sleep my MacBook Pro when going from class to class. Waiting a minute or longer (4GB RAM) for the laptop to begin sleeping means I have to wait to put it in my bag or risk damaging the hard drive as it’s busy writing, not to mention the potential for heat build up with the laptop tucked away in my bag. I don’t really care if the laptop enters safe sleep - I don’t change batteries in sleep mode that often anyways and the possibility of the battery just falling out isn’t too great.


Demoing Sleep Mode 0 from Paul on Vimeo.
With mode 0, it takes ~5-10 seconds to sleep compared to ~ 1 minute with 4GB RAM.

In this case, my solution was simply switching the sleep mode to old school mode 0. Everything remains in powered-on RAM and that’s it; no hard drive mumbo jumbo to slow me down. MacWorld has an old but still relevant post about how to accomplish switching between sleep modes.

In a nutshell, your Mac is currently in sleep mode 3 and you want to go to sleep mode 0. Just run the following command in the terminal, enter your password when prompted and test out your fast-sleeping Mac.

sudo pmset -a hibernatemode 0

Just don’t blame me if your battery does actually fall out while your mode 0′d MacBook is sleeping and you lose your session data. Will you try out this sleep mode for speed or are you more concerned about “what if” cases and like your RAM dumped to disk before entering sleep?

Now, if only there was a terminal command I could run so the optical drive stopped making that stupid sound everytime the computer wakes up.

11 people have saved this post on del.icio.us. Why not bookmark it?




26 Comments

  1. Windows has had hybrid sleep support for Laptops for a long time now. It’s the best of both worlds.

    But once Apple implements this feature in Mac, it will be big news. I am sure it will be one of the 600 features in the next OS X release.

  2. Thanks for the tip! I didn’t even know the OS was trying to write stuff to the HD as it was going to sleep.

  3. It should be mentioned that unlike Tiger, Leopard changes the power profile settings when disabling safe sleep. This means your battery power settings will no longer read “Better Energy Savings” or “Better Performance” and instead will read “Custom”.

    There is no harm in that, as your original settings remain, it’s just important to note that then changing the profile will reset the safe sleep setting back to 3 (enabled). If you need to mess with your power settings, do it through the Energy Savings preference pane.

    I found out this the hard way after fighting with Leopard for a couple weeks until I realized what was turning on my safe sleep again.

  4. I’m sorry, Dileepa, but Macs do have hybrid sleep support for laptops, that was what Paul was talking about here.

  5. I think I will put up with the delay for the safe sleep.
    Thanks for the tip though.

  6. If I had a MacBook I would totally do this. When I hear the lid “click” it should be done writing to the HDD. Like you I am always in a hurry and can’t wait a full 30 seconds to put it in my bag.

    I have, on more than 100 occasions, put my POS Windows XP system in my bag only to find that it never when to sleep! What give? Over all the times it happened to me, i’ve only lost one HDD.

  7. Paul- your MacBook (Pro) makes that sound when it wakes up, too? Mine is so much louder than my friends’ Macbooks, but from your post it seems that I’m not alone in my “plight” :-P

    My MacBook sometimes decides it doesn’t want to wake up, and it takes a few openings and closings of the lid and some random key mashing for it to work…but it wakes up eventually.

    It’s still better than my last Windows laptop that decided to “eat” some of my class notes when I woke it from sleep. I think that was the last straw for me with regard to Windows.

  8. Paul! I love this post. I cannot believe I hadn’t heard of this. Solved so many of my problems!

  9. I was going to do this, but I’m scared of losing my MacBook. I’ll pass this time around, but overall a great little tweak.

    Indraneel Purohit on Dec 6th, 2007 at 9:31 pm
  10. Very cool tip, thanks paul.

    btw. Is that some Shiny Toy Guns I heard playing at the beginning? Sounded like “You Are The One”.

  11. Awesome tip, thanks!!

  12. Excellent tip. When leaving for class I rarely have time to go through a slow and methodic process of putting my laptop away. I just grab it and go.

  13. I really don’t like that stupid sound that the optical drive makes when waking up. Lightroom triggers that sound as well when it launches the import dialogue.

  14. Thanks for the great suggestion Paul. This will help when I’m using my MacBook around campus.

    Nice insight @Ronald Heft.

  15. Regarding the optical drive, if you have a way to permanently disable it , I would be so happy :)

  16. Did this months ago, and it’s a good tip.

    Also, I disabled the “wake when lid opened” while I was fiddling with pmset, so I have a chance to plug in Ethernet and USB cables before the machine wakes up.

    Finally, if you don’t know already, Command-Option-DiskEject will put the machine to sleep instantly. (Unlike what some sites say, you don’t need to hold that combination down for 2 seconds; just hitting it quickly is enough.)

    So with hibernation disabled (it’s basically useless for me), I can hit those keys, slam the lid shut, and have my MBP in my briefcase right *now*, instead of waiting around for thirty seconds for the light to start blinking.

    Yes, we’re impatient. :-)

  17. Nice very helpful

  18. Thanks for the tip, Paul. I just changed to mode 0 on my 2GB MBP and I like it. Waiting around for that light to start flashing before moving the computer was starting to annoy me.

    You would think mode 0 would be the default, considering that after closing the lid, most people are going to pick up and move their macbook EXACTLY when they shouldn’t be (when the disk heads are busy writing RAM contents). I wonder how many failed hard drives this has led to?

    And, just to be clear, the ‘worst’ that is going to happen should your macbook lose power when in mode0 sleep, is that you’ll lose whatever unsaved data you had running in applications when you put the computer to sleep, correct? You’ll just do a fresh boot when you power it back up. Some commenters above seem to think you’d be risking the entire computer or something.

    Thanks again!

  19. Guess I am happy for once that I have a slightly older MacBook!

  20. Thanks for the tip Paul, oh and teaching me something new about how OSX works.

    Jack.

  21. @Chris - this isn’t a recent thing. It has been the default sleep mode (mode 3, the one I’m trying to avoid for sleep speed) for all Macs since ~fall 2005.

  22. Thank you so much for this Tip. I Just bought a new MacBook Pro today and i was confused at why with so much more power over my old MacBook, why it was taking so much longer to go to sleep. This Helped allot as i too sleep my notebook between classes. I Always have juice in my battery, and i frequently save my work, so i don’t think ill have to worry about loosing anything from running out of power.

  23. Hey paul! I see immense potential in you :) I wish every 21 yr old is on the same page with u … much more efficient future ;)

    Anyways I just tried this tweak, works great! I am sure battery charge would be the same once it wakes from the sleep mode….

    Thank a lot buddy :)

  1. [...] post de hoje do Paul Stamatiou foi bastante esclarecedor para mim. Há tempos noto que o meu Mac demora um pouco [...]

  2. [...] big ups to Conrad for sharing Stamatiou’s really useful OS X hack for turning off safe-sleep mode. Posted in Tech | Tagged • Apple • hacks • Leopard • Time Machine RSS [...]

  3. [...] a short terminal command (via Paul) to change the sleep-mode from the default “3″ to “0″ which fixes the slow [...]

Post a comment, receive Stammy points.


Send a trackback.


  • If you plan on posting code, run it through Postable first.
Copyright © 2005 - 2008 PaulStamatiou.com  Privacy Policy - Terms of Service Can't spell my name? Use PSTAM.com. Go back up ↑.