Guide
caffeinate: keep your Mac awake from Terminal

Before there was any app, I kept my Mac awake with caffeinate for years. ⌨️ The command is baked into macOS, it's reliable and it's free. If you're in the Terminal anyway, it's often the fastest fix. Here's everything you need, compact and without the waffle.
⚡ The quick start
Open Terminal, type one line, hit Enter. As long as the window stays open, caffeinate keeps the Mac awake. Ctrl+C stops it.
caffeinate -d | ☀️ Keeps the display awake. Nothing dims, the screensaver stays off. |
|---|---|
caffeinate -i | 🖥️ Prevents system sleep (idle sleep). The screen may dim, the machine keeps working. |
caffeinate -m | 💾 Prevents the disk from going to sleep. |
caffeinate -s | 🔌 Keeps the system awake, but only on AC power. |
caffeinate -dimsu | 🚀 The "keep everything awake" combo. Handy, but blunter than needed. |
⏱️ With a time limit instead of forever
Few people know the -t option, yet it's the most useful one. The number is seconds:
caffeinate -t 3600 keeps the Mac awake for exactly one hour, then releases it. Two hours would be 7200, half an hour 1800. And there's the catch: if you mean "until tomorrow morning", you have to do the math first.
🔗 Only while a command runs
My favorite trick for scripts: append the actual command. The Mac then stays awake exactly as long as the task takes, and sleeps again automatically afterward.
caffeinate -i ./my-backup.sh
It's clean because nothing lingers. The moment the script finishes, the awake state is gone.
🚧 Where caffeinate hits its limits
As good as the command is, day to day it grates in three spots:
- 👀 You can't see whether it's still running or how long is left. No status, no countdown.
- 🪟 Close the Terminal and it's over. Keeping it in the background means adding
nohupor&, and that gets fiddly again. - 🔁 For "just for a moment" you won't type it every time. Especially if you don't live in the Terminal anyway.
🖱️ The convenient alternative
Under the hood, good menu bar apps use the same mechanism as caffeinate, namely Power Assertions. You click a switch, set a timer like "4 hours" or "until 9 a.m. tomorrow", and always see how long is left. Display, system and network can be toggled separately. If that beats calculating a seconds value each time, a small app is worth the price of a coffee. ☕️
caffeinate, but as a switch 🎩
Helmlet brings keeping awake into the menu bar: system, display and network individually, each with a timer and countdown. Afterwards everything returns to normal automatically.
Get Helmlet