Keep your Mac awake while your coding agent is working

Caffeine keeps the one-click cup, then releases your Mac to sleep when Claude Code or Codex finishes a turn and waits for you.

Download for macOS

macOS 14+ · MIT

0 stars · Open source
Terminal
74%Mon 9:41
working… caffeine holds the wake session✓ turn complete · waiting for you

How Caffeine stops your Mac sleeping during agent work

One click still does the job

Click the cup to keep the Mac awake. Click it again and macOS can return to its normal sleep settings.

Agent Watch follows the turn

Optional Claude Code and Codex hooks start a session with the work and release it when the agent finishes or needs input.

Protect the battery and display

Set timers, battery limits, display behaviour, and a best-effort closed-lid mode without rewriting system settings.

Control the same state from a CLI

Turn Caffeine on, start a timed session, switch it off, or read status as JSON from scripts and agents.

See what else is blocking sleep

The panel lists other processes holding power assertions, so you can tell who is really keeping the Mac up before blaming Caffeine.

No work data is uploaded

Prompts, process details, and hook payloads never leave the machine. Session markers are plain local files you can read yourself.

Native power control that stays on your Mac

No administrator access
The app uses normal macOS power assertions and does not install a privileged helper.
Signed and notarised by Apple
Public builds are signed with a Developer ID and notarised, so macOS can verify nothing changed since the build.
Process watching is separate
A fallback can watch several coding-agent processes, but it stays off until you choose the broader behaviour.
Closed-lid mode is best effort
Caffeine can request it, but macOS and the hardware make the final decision. System power settings are never rewritten.

Common questions about Caffeine

Which agents can Caffeine follow?

Lifecycle hooks follow Claude Code and Codex turns. Optional process watching also supports OpenCode, Aider, Amp, Gemini CLI, Cursor Agent, and Goose.

Does Caffeine change pmset?

No. It uses macOS power assertions. Closed-lid mode is a best-effort request, and macOS still decides what the hardware allows.

Does anything leave my Mac?

No work data does. Preferences and session markers stay local, and Caffeine does not upload prompts, hook payloads, process details, or usage data.

Is this the original Caffeine app?

It is an independent Swift rewrite of it. Tomas Franzén of Lighthead Software created Caffeine in 2006, and Michael Jones at IntelliScape Computer Solutions carried it forward from 2018 once the source was opened up. This version keeps the one-click cup and the MIT-licensed menu bar artwork, then adds Agent Watch for coding agents. The official Caffeine FAQ tells the full story.

How do I prevent my Mac from sleeping?

Click the Caffeine cup to start a wake session. Click it again to release the power assertion and let macOS use its normal sleep settings.

Can Caffeine keep a Mac awake with the screen off?

You can choose whether a session keeps only the system awake or also keeps the display awake. macOS still controls what the hardware permits.

Can Caffeine keep a Mac awake with the lid closed?

Caffeine can make a best-effort closed-lid request, but macOS and the Mac hardware make the final decision. It does not rewrite system power settings.

Will Caffeine stop when Codex or Claude Code finishes?

Yes, when Agent Watch is enabled. Lifecycle hooks hold the wake session during a turn and release it when the agent finishes or waits for input.

Let the Mac sleep when the agent has stopped doing useful work.

Download for macOS

macOS 14+ · MIT

0 stars · Open source