If you have a MacBook Pro with several gigabytes of RAM, you may have noticed that Mac OS X will lock up when you try to wake the laptop up. This can be very frustrating and requires you to hold the power button in for 5 seconds and turning it back on.

I run 2 or 3 VMware Fusion virtual machines at the same time and that eats up a ton of RAM, but it’s OK since my laptop has 8GB of memory. My machine would lock up when I tried to wake it up. I found that it would sometimes be OK leaving 1 virtual machine running, but if I left 2 running, it would almost always lock up.

So, I did some research and discovered the problem has to do with Mac OS X’s power management, specifically the hibernatemode. The value is a bitfield that has the following options:

  • 0 (0000) Disables SafeSleep. Memory state is maintained until battery power is gone in which case the computer turns off completely.
  • 1 (0001) Enables hibernation, writes memory contents to hibernation image, and immediately goes to sleep.
  • 3 (0011) Maintains memory state while sleeping, but when the battery power is nearly gone, it will write the contents of the memory to hibernation image.

On laptops, the default value is 3. On desktops, the default is 0.

To fix the problem, you simply need to set the hibernatemode to 0. From a Mac OS X terminal, run the following:

sudo pmset -a hibernatemode 0

Then reboot your laptop and enjoy lock-free waking up!

At this point, hibernation is disabled and that means you can delete the hibernation file and free up a couple gigs of disk space!

sudo rm -f /var/vm/sleepimage

One side note, Microsoft Windows actually disables hibernating on computers with 4GB or more of RAM. They claim that it took longer to restore the memory state from disk than to just do a normal boot. I disagree since it takes a long time to spin up all your apps, virtual machines, and start being productive. I wonder if they discovered some technical issue that is what is causing the issues on Macs.

Tonight I gave a talk about Cassandra at the Minnesota PHP User Group. I would hope that everyone that came out learned a little something. I have to admit the talk was a bit unorganized, but hey, I love to talk. It also didn’t help that there was major construction going on at the meeting venue that made it hard for people to hear me.

After rambling for an hour and a half, I finally ran out of Cassandra-related stuff to talk about. Since some people were interested in some new features of PHP 5.3, I showed off my MVC framework I’ve been working on called Elevate. In Elevate’s code, I use some of PHP 5.3’s new features such as closures, namespaces, and the ternary operator (?:). I also showed Elevate’s super cool Gearman worker daemon that I used for sending e-mails.

This Thursday, May 6th, at 6pm I’ll be giving a talk about Cassandra at the Minnesota PHP User Group.


I’ll be covering Cassandra’s architecture and how it scales to handle tons of data and still be fast and fault tolerant. I’ll also cover Cassandra’s API and data modeling, specifically with PHP.

The user group will meet at Nerdery Interactive Labs (9555 James Ave S, Suite 245, Bloomington, MN 55431). It will surely be packed with tons of awesome, so be sure to RSVP!