HoldMyCode vs Amphetamine vs caffeinate
All three keep a Mac awake. What differs is who decides when: you, a rule you set up, or the agent itself. If you run coding agents like Claude Code, that decides whether your Mac sleeps on time or cooks in your bag.
| HoldMyCode | Amphetamine | caffeinate | |
|---|---|---|---|
| Price | Free | Free, Mac App Store | Built into macOS |
| What starts it | A coding agent starting a task | You, or a trigger you set, such as an app running | You, from Terminal |
| What ends it | The task finishing | You, a timer, or the trigger ending | You, a timer, or the wrapped process exiting |
| Agent idle at a prompt | Mac can sleep | Stays awake while the app runs | Stays awake while the process runs |
| Lid closed | Yes, no external display needed | Yes | No |
| Knows if an agent is working | Yes, through lifecycle hooks | No | No |
| Built for | Coding agents only | Anything | Anything |
Amphetamine
Amphetamine is a free, long-standing keep-awake app with a lot of options: sessions for a set time, and triggers such as while a given app is running, while the battery is charging, or while a device is connected. It can keep a MacBook awake with the lid closed. As a general-purpose tool, it's a good one.
The gap for agent work is that its triggers check whether an app is running, not whether it's working. A terminal with Claude Code open at a prompt counts as running, so the Mac stays up whether or not a task is in progress.
Caffeine and other toggles
Caffeine and its many look-alikes are one switch in the menu bar: on keeps the Mac awake, off lets it sleep. Simple, and entirely manual. The usual failure is leaving it on.
caffeinate
Built into macOS, nothing to install. caffeinate -i claude holds for as long as
Claude Code runs. It won't stop lid sleep, and it counts idle time at the prompt as running.
More in keeping Claude Code running with the lid closed.
HoldMyCode
Built for one case: keep the Mac up while a coding agent is doing a task, and only then. Claude Code, Codex, Gemini CLI, Cursor and Cline report working and idle through lifecycle hooks, which HoldMyCode installs itself (Cline asks first). Claude Cowork is read from the Claude app's task logs. The hold covers a closed lid, and it gives up at a battery threshold you pick.
The trade-off is that it's only for agents. To keep a Mac awake through a long download or
a presentation, Amphetamine or caffeinate is the right tool.
Which one should you use?
- You run Claude Code or another coding agent and close the lid mid-task: HoldMyCode.
- You want a general keep-awake with rules for any app: Amphetamine.
- You need it once, lid open, with nothing to install:
caffeinate.
Awake for the agent, asleep after.
Free, about 4 MB, macOS 14 Sonoma or later. No account, no licence key.