At a glance (as of Oct 2026)
| Lidwork | caffeinate | |
|---|---|---|
| Idle sleep | Prevented | Prevented (-i) |
| Lid closed, no monitor | Yes | No — the Mac sleeps on lid close |
| Password | None | None |
| If it crashes | Background part turns lid sleep back on: at once after a crash, within 30 s after a hang | Nothing to restore — the assertion ends with the process |
| Battery cutoff | 10 / 20 / 30%, on in every session | No (use -t for a time limit) |
| Interface | Menu-bar star | Terminal |
| Price | $9.99 once, Mac App Store | Free, built into macOS |
Why caffeinate stops at the lid
Try it: run caffeinate -dimsu on battery, start a download, close the lid. Within seconds the Mac is asleep and the download stops. caffeinate creates power assertions that block idle sleep. Closing a MacBook's lid without an external display is a separate, explicit sleep path, and macOS sleeps anyway. The only built-in override is the global pmset disablesleep switch, which caffeinate doesn't touch — and which, unlike caffeinate, doesn't turn itself off. Full details: caffeinate on Mac, every flag explained.
On battery it is even stricter
caffeinate -s only works on AC power, and Apple's own closed-display mode needs a charger plus an external display and keyboard. Unplugged, with nothing attached, no caffeinate flag and no Energy setting keeps a closed MacBook running. That is the case Lidwork exists for: it keeps a closed MacBook awake on battery, stops at the battery level you choose (10, 20 or 30%) or when the Mac gets too hot, and if Lidwork quits or crashes, its background part turns its lid hold off so normal sleep comes back.
Use caffeinate when…
- The lid stays open, or it's a desktop Mac.
- You want “awake while this command runs”:
caffeinate -i ./job.shis perfect. - You live in Terminal anyway. Our command builder writes the flags for you.
Use Lidwork when…
- You close the lid and leave — commute, meeting, bag.
- You'd otherwise use
sudo pmset -a disablesleep 1and might forget the undo. - You want a battery floor and a background part that turns sleep back on if the app crashes.
Using both
They don't conflict. A good pattern for agents and builds: caffeinate -i for the job while you're at the desk, Lidwork switched on only for the part where the lid is closed.
FAQ
Does caffeinate work with the lid closed?
Not on a MacBook without an external display. caffeinate blocks idle sleep; closing the lid is a separate sleep request that macOS honours anyway, on battery and on power.
Does caffeinate -s keep a closed MacBook awake on the charger?
No. -s blocks system idle sleep while on AC power, but lid-close sleep still happens unless the Mac is in Apple's closed-display mode (charger, external display and keyboard).
Which caffeinate flag keeps the Mac awake with the lid closed on battery?
None of them. -d, -i, -m, -s and -u all act on idle sleep. Only the global sudo pmset -a disablesleep 1 switch, or an app that manages lid sleep, keeps a closed MacBook awake on battery.
Is there a free alternative?
Yes: sudo pmset -a disablesleep 1, then sudo pmset -a disablesleep 0 when you are done. It does not turn itself off, so a forgotten undo leaves the Mac awake until the battery is empty.