Keep Claude Code running without the Mac going to sleep on macOS
You want the session to carry on while you do something else. But something that is working presses no keys — and that is exactly what macOS uses to decide whether anyone is at the machine.
Why the run stops the moment you walk away
macOS decides about sleep by time without input, not by load. A session in Claude Code reads files, calls tools and starts test runs — and produces not one keystroke while doing it. The same holds for Codex, for an agent inside Cursor, for Copilot, for Gemini CLI and for every other tool of this kind, whatever model does the thinking behind it: GPT, Claude or Gemini.
To the system, a machine pinned at a hundred percent on every core is therefore the same case as an empty desk. After the configured idle time it sleeps, and the run stops mid-step.
What sleep does to a job in flight
In sleep, processes are suspended and open connections drop. Whatever was waiting on a response loses it; a tool call runs into its timeout; the stream of requests and replies breaks exactly where it was.
After waking, the process is often still there and the run is gone anyway: what should have arrived in the meantime did not. In practice that means starting over — not at step thirty, but at step one.
Closing the lid is a second case
On macOS, staying awake and lid-closed are two separate rules. Close the lid while the job is running and you lose it even with a keep-awake session running: assertions do not apply there.
That is what lid mode is for, and it flips a system setting. It needs a small helper of its own; without it the switch has no effect. With it, the machine carries on closed until the span you chose ends.
A span rather than permanent on
A long job has an expected end. That is what the span is for: two hours for a refactor, five for a large pass, twelve for anything running overnight. Time remaining and end time sit in the panel.
This is more than tidiness. A machine that sleeps by itself afterwards spends no battery on nothing — and nobody has to remember to switch something off the next morning.
Before you start
- Pick a span more generous than the job needs — an aborted run costs more than being awake too long.
- Check the menu bar icon: filled means the keep-awake session is running.
- Closing the lid? Then turn on lid mode as well, or the session will not help.
- Plug in the charger if the job is planned to take more than an hour.
Common questions
Does this keep the network connection open too?
No. Toxin prevents sleep — which removes the most common reason a connection breaks mid-run. If Wi-Fi drops for some other reason, no keep-awake app helps.
Do I have to switch this on for every run?
Either a span per run, or unlimited and one click at the end of the day. Unlimited is free; the spans are Pro, a one-time €4.99.
A session that carries on while you are not at the machine is the reason this app was built. Toxin is a menu bar app for macOS and is not on the Mac App Store yet.