No way to disable the built-in caffeinate sleep inhibitor on macOS
Claude Code on macOS spawns caffeinate -i -t 300 while a turn is active (renewed
on an interval, killed shortly after activity stops). Verified on 2.1.220.
Two problems:
- It's undocumented. The settings reference, env-var reference, CLI reference,
and changelog don't mention sleep prevention at all, so users discovering the
process have no way to know it's expected behavior.
- There's no off switch. No settings key, env var, or flag disables it — the
internal disable flag is compiled to false. Users who manage keep-awake
deliberately (One Switch, Amphetamine, corporate power policies, battery-life
discipline on older machines) can't tell Claude Code to stay out of power
management. The workaround is killing the child process from a hook, which is
what I'm doing today — it works, but it's fighting the tool.
Request: a documented way to opt out — a disableSleepPrevention settings key
or CLAUDE_CODE_DISABLE_SLEEP_PREVENTION env var — plus a line in the docs about
the default behavior.
Happy to provide process trees / version details if useful.