The Big Sleep


The Big Sleep

Here’s the thing: Mac OS X is great . . . usually. But if you’ve ever been connected to a network share and put your laptop to sleep and then had the audacity to wake it up on a different network – whoa boy! You can expect nothing less than a five minute, spinning beach ball of death, Finder freeze-up. For reasons unknown, OS X decides to freak out and hang if it can’t find a network share. I’ve written a short, dramatic piece illustrating what I’m talking about.

Location: a dimly lit office at night.

Tyler enters the room carrying his MacBook Pro under one arm and lays it on the desk. He opens the computer’s lid. A bright light fills the room.

Finder: Whoa! Where’s that network drive? Waah! Ughh. Bleep boop. Fghzgh! Grrr! Zap Pow! Ahhhhhhhh!

Tyler: Calm down, Finder. It’ll be ok. You’re just on a different network.

Finder: But the network drive is goooooonnnnne!!!

Tyler: Your point? Simmer down and just pretend it never existed. I thought you were the world’s most advanced operating system? Start acting like it.

Finder: But . . . but . . . what are you doing?! No! Don’t press that!

The screen goes black as Tyler removes his finger from the power button.

And . . . Scene.

Ok, so maybe I’m being a little too dramatic, but this happens to me at least once a week. Luckily, there’s a way to fix it.

Bernhard Baehr makes a wonderful utility called SleepWatcher which lets you assign scripts to run right before you machine goes to sleep or after it wakes up. Download and install.

Next, create a file in your home directory called “.sleep”. SleepWatcher will run the commands in it as soon as it detects your system about to sleep. Add the following awk script to .sleep.

mount | awk ‘/^afp_/ { system(“umount -f ” $3) }’

That command pipes a list of all mounted drives into awk and forcibly disconnects any AFP shares it finds.

Voila! No more Finder crashes.

Comments are closed on this post