A dose of caffeine for my MacBook

One problem that has slowly gotten worse with time is the responsiveness of my MacBook Air upon waking from sleep. (I'm on a 2011 13-inch "high end" model.) The time it takes for the keyboard to become responsive and allow me to begin entering my password has increased since I first got the MBA in late 2011. Recent OS upgrades have only exacerbated the issue. I set out this weekend to find a way around the issue.

There are several long running threads on Apple's own support forums, each ending with a "submit a bug to Apple" link. After submitting my own bug report, I wasn't quite satisfied. A better crafted Google query provided a link to a solid document written in 2010 about Apple's various hibernate modes. Jackpot!

Apple provides three different modes of hibernation:

  • hibernate mode 0 -- suspend to RAM only (default on desktops)
  • hibernate mode 1 -- suspend to disk only
  • hibernate mode 3 -- suspend to disk + RAM (default on laptops)

You can find your current hibernate mode by running the following command in Terminal.app:

$ pmset -g | grep hibernatemode hibernatemode 3

As the documentation indicates, on a portable device (such as my MBA) the default hibernate mode was '3'. When my MBA is put to sleep (which happens when I close the lid) the operating system suspends all objects "in flight" to both disk and RAM. When I open the lid to wake the MBA from sleep, there is a pause as the OS reads its previous state from both disk and RAM.

Mode 3 is ideal for laptops because of their risk in losing power, thereby losing a hibernate state stored only in RAM. If you're running a laptop in Mode 0 and run out of power then your hibernate state is lost and you essentially bring yourself back to an operating state by a full reboot. Desktops default to Mode 0 because they're always plugged in.

I'm fairly good about always having juice in my MBA, so the risk of losing any unsaved work while running in Mode 0 doesn't concern me. It's pretty easy to go from Mode 3 to Mode 0:

sudo pmset -a hibernatemode 0

Before taking a dive head-first I saved all my work and then closed the lid of my MBA. I waited a few moments, cracked open the lid, and viola! My keyboard and pointer were instantly responsive. This is exactly the feel I expect from my MBA.

I've been running with this setting for 48hrs now through multiple sleep/wake scenarios. So far I've seen no ill affect of my change. I'll report back if anything presents itself.

Updated 09/04/2012:

Well over a week and Mode 0 has been working quick well for me. My MBA is wide awake the moment the lid is cracked and I have yet to have lost any work as a result of the change. A funny thing though... I'm writing this update from a coffee shop in Seattle (Bumpershoot 2012!) and my day-to-day routine of keeping my MBA charged at my desk has been interrupted. As a result, I'm running on fumes with a 7% charge remaining. I'm not all that nervous as everything is in a saved state, but as soon as I cracked the lid and saw less than 10% juice remaining, the reality of my change sank in. Again, no nervousness about the situation, but a reminder that provided my day-to-day routine stays intact all is well. Interrupt it at all, and I put unsaved work at risk.

All the same, I highly recommend Mode 0 to anyone who has been frustrated by the slow wake times after recent OS X updates.