Caffeinate

I’m currently taking a web-based continuing education class, which means that every Monday evening I fire up Google Chrome to watch a Flash-based1 live webinar presentation. During the 90 minutes of class, I do just about nothing with the computer, which means its display would go to sleep if I didn’t do something to prevent it.

For years, the standard Mac utility for keeping your screen (and computer) from falling asleep was Caffeine, a free menubar app from Lighthead Software. But Caffeine hasn’t been updated in years, and I understand its behavior has been questionable under recent OS releases.

The current fave seems to Amphetamine, another free menubar app. Katie and David talked about it on a recent episode of Mac Power Users, and it sounds pretty good. There are plenty of others—just do a search for “caffeine” on the Mac App Store to see a sample.

Some Caffeine replacements on the Mac App Store

But you know me. Why would I use a nice polished program with a GUI when I can run a Terminal command? And even though I own Bartender, I’d still rather keep my menubar apps to a minimum.

So I use the caffeinate command, whose name, I believe, was lifted from Caffeine in what must be Apple’s lamest piece of Sherlocking ever. It’s a sort of limited version of pmset, the older, more powerful, and considerably more complicated power management utility.

Caffeinate has only a few options and the ones I use are -d, which keeps the display from sleeping, and -t which sets a timer to stop caffeinate in case I forget to. The command I used tonight was

caffeinate -dt 6000

which kept the display awake for 100 minutes (6000 seconds), enough for the 90-minute class plus a cushion. You can find other uses in the man page and in this Brett Terpstra post from a few years ago.


  1. Yes, like an animal. ↩︎