Mac went to sleep in the middle of a Cursor agent task, and now you're here. Short answer below, then the free option, then the tool built for exactly this.
To keep your Mac awake while Cursor's agent runs:
the free way is macOS's built-in caffeinate -i — run it in Terminal before you start,
and stop it yourself when the run ends. The automatic way is AgentBarista (14-day free trial,
then $19 one-time), which detects Cursor's agent working and lets your Mac sleep when it finishes.
macOS sleeps your Mac based on keyboard/mouse activity and CPU load — not on whether
Cursor's agent is mid-task. When the agent is waiting on a model response, your Mac can sit near 0%
CPU for long stretches, which looks idle to macOS even though real work is still running. The
immediate fix: open System Settings → Lock Screen (or Battery on older macOS) and turn
off "Turn display off" / set it to Never while you're running long agent tasks, or run
caffeinate from Terminal before you kick off the task. That stops the sleep — it just
doesn't know when Cursor is actually done, so you have to remember to turn it back off.
caffeinate (built into every Mac) and Amphetamine
(free, Mac App Store) will both keep your Mac awake on a timer or while a process you pick is
running. If you only run Cursor's agent occasionally, that's a perfectly fine choice — no need to
install anything else. Where they fall short is the same place every plain keep-awake tool falls
short: they don't know when Cursor's agent specifically starts and stops, so you either babysit them
or they keep your Mac awake — and your battery draining — long after the agent finished.
AgentBarista watches Cursor specifically — CPU usage and the on-screen text in its agent panel — and keeps your Mac awake only while there's a real, active task running.
Cursor's agent can sit at near-0% CPU while waiting on a model. AgentBarista reads window text too, so it knows the agent is still working even when CPU alone looks idle.
Once the agent finishes or goes idle, normal sleep comes back within your grace window — 90 seconds by default. No babysitting a timer, no battery held hostage overnight.
Already run Claude Code, Codex, or another agent in another window? AgentBarista watches all of them — not just Cursor — from one menu-bar app.
Pro is $19 once — not a subscription. Updates included for a year. Founding price is $15 for the first 200 customers. Prefer to pay once and never think about it again? Lifetime is $39 once, all future updates included.
Not live yet — leave your email and we'll ping you the moment it is.
Running a team of devs on Cursor instead of just you? See team pricing.
Same Mac-goes-to-sleep problem, different tool. Each of these guides covers the fix for that agent specifically: