/mac-caffeinate:caffeinate-computerfrom mac-caffeinate
Keeps macOS awake during long-running builds, agents, or commands using caffeinate. Provides patterns for PID-based, command-wrapping, and time-bounded usage.
Ships in mac-caffeinate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
macOS ships caffeinate. Use it. No daemons, no apps, no half-open laptops in airports.
If uname is not Darwin, say so and stop:
Not macOS —
caffeinateis a macOS-only tool. On Linux, usesystemd-inhibit,caffeine, orxset s off -dpmsdepending on environment.
Pick based on what the user is doing.
When there's already a PID — a running claude session, build, sync, agent loop:
caffeinate -i -w <PID> &
-i prevents idle sleep-w <PID> exits caffeinate when that PID exits& backgrounds it so the shell stays usableFind the PID with pgrep -f claude or echo $$ from inside the long-running shell.
When launching the long task fresh:
caffeinate -i <command and args>
caffeinate exits the moment the wrapped command exits. Cleanest pattern — no orphan processes, no manual cleanup.
caffeinate -dimsu -t 28800 # 8 hours
-d display sleep-i idle sleep-m disk sleep-s system sleep (only effective on AC power)-u declares user activity (resets idle timer for 5s, useful as a one-shot nudge)-t <seconds> auto-expire so it can't run foreverUse -s only when plugged in. On battery, drop it: caffeinate -dim -t <seconds>.
caffeinate alone does not keep a MacBook awake with the lid shut on battery. For true clamshell-while-unplugged you need external power + display + input, or a tool like InsomniaX/Amphetamine. Tell the user this if they ask about closing the lid.
| Goal | Flags |
|---|---|
| Just stop idle sleep during a task | -i |
| Also keep the display on (watching output) | -di |
| Long unattended run, plugged in | -dimsu -t <sec> |
| Tied to a specific PID | add -w <PID> |
man caffeinate has the full list. Don't invent flags.
uname → Darwin).kill %1 for backgrounded &, or it self-exits when the PID/command/timer ends.Keep it tight. One command, one line of explanation.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub jtsternberg/claude-plugins --plugin mac-caffeinate