Claude Code, Claude Desktop, Codex and the rest will happily work for an hour on their own. Your laptop, left alone, will not. After a few minutes without typing it dims the screen, then locks, and on a MacBook it eventually sleeps. A sleeping machine runs nothing, so the agent stops mid-job and you find out later. That's the whole problem, and it has a few honest answers before you need any extra software.
First: use the tool's own keep-awake if it has one
Recent versions of the Claude Code desktop app have a keep-awake option for a session. If yours has it, that's the cleanest answer for a single run: switch it on, start the job, done. It does exactly one thing, which is stop the machine sleeping while that session is live, and it switches itself off afterwards.
Codex in the terminal doesn't have an equivalent as far as I can tell, and neither do most other agents, so the rest of this post is for them, and for anyone whose Claude Code is a version behind.
On a Mac: caffeinate, which is already installed
macOS ships with a Terminal command called caffeinate. Run it and your Mac won't sleep until you stop it. The neat trick is to wrap the agent in it, so the keep-awake lasts exactly as long as the job and not a minute longer:
caffeinate -i claude
caffeinate -i codex
The -i flag stops idle sleep. Add -d if you also want the display to stay on (caffeinate -di claude). When the agent exits, caffeinate exits with it. There's more on the command in keeping your Mac awake.
Two catches. Close the lid and a MacBook sleeps anyway, caffeinate or not, unless it's on power with an external display attached. And caffeinate creates no activity at all, so Slack and Teams still mark you Away after a few minutes, because they go by input, not by whether the processor is busy.
On Windows: PowerToys Awake, or the power settings
There's no caffeinate on Windows. The nearest thing is PowerToys Awake, a free Microsoft utility that sits in the tray and holds the machine awake for a set time or until you turn it off. If you'd rather not install PowerToys, go to Settings, then System, then Power & battery, then Screen and sleep, and set both timers longer, or to Never while plugged in. Then remember to put them back.
Same two catches. A closed lid still sleeps the laptop, and a managed work PC may lock on a schedule that no app can override. And again, nothing here keeps a chat status green.
The gap: awake is not the same as present
This is the bit that catches people. Every tool above keeps the computer running. None of them makes you look active. Slack, Teams and the like watch for mouse and keyboard input, so an agent can be churning away for an hour while your status quietly slides to Away. If that doesn't matter to you, stop reading and use caffeinate. If it does, you need something that creates real input while you're not there.
That's what Green Dotter is for. It's a free Mac and Windows app with a Keep awake toggle (on a Mac it uses caffeinate underneath, on Windows the equivalent system call) plus a Wiggle only mode that moves the mouse the way a hand does: gentle curves, the odd pause, never quite the same path twice. Pick how long, press Start, and both the machine and the dot stay up. Touch the mouse and it pauses on its own, then carries on once you've been idle for a few seconds.
One honest caveat for agent users. If the agent is actually driving your mouse, which some computer-use tools do, Green Dotter will treat that as you and pause. For a terminal agent like Claude Code or Codex that never comes up, because they don't touch the cursor.
What a sensible setup looks like
- A single run on a Mac: wrap the command in
caffeinate -i. Nothing to install. - A single run in the Claude Code desktop app: its own keep-awake toggle, if your version has it.
- An overnight run on a laptop: plug it in and leave the lid open. Nothing keeps a closed MacBook running, and a laptop on battery will protect itself eventually whatever you tell it.
- A long run while you still need to show as Available in Slack or Teams: Green Dotter with Keep awake on and Wiggle only running for the length of the job.
And whichever you pick, check your workplace policy if it's a work machine. Keeping a laptop awake for an agent run is a normal thing to need. Keeping a status green while you're at the park is a different conversation, and not one this post is having.
FAQ
Does Claude Code keep my computer awake on its own?
A plain terminal session doesn't. Recent versions of the Claude Code desktop app have a keep-awake option for the session; if yours has it, use that. Otherwise wrap the run in caffeinate on a Mac, or use PowerToys Awake on Windows.
Does caffeinate keep Slack or Teams active?
No. caffeinate only stops the Mac sleeping. Slack and Teams watch for mouse and keyboard activity, so your status still drifts to Away. For that you need something that creates real input, such as Green Dotter's wiggle mode.
Will my MacBook keep running Claude Code with the lid closed?
Not on its own. Closing the lid sleeps a MacBook regardless of caffeinate or any app, unless it is plugged in and connected to an external display. Leave the lid open for long runs.
How do I keep a Windows PC awake while Codex runs?
Use PowerToys Awake, or raise the screen and sleep timers in Settings under Power and battery. Neither keeps a chat status active; Green Dotter's Keep awake toggle plus wiggle mode does both.
Is Green Dotter free?
Yes. No account, no ads, Mac and Windows. It sends anonymous usage stats and nothing personal.
A note on workplace policies: how you handle presence depends on your role, your tools, and your employer's policies. Before relying on any presence or automation tool, make sure you understand what is allowed on your work device.
Related: download the Mac auto clicker or the Windows auto clicker.