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, which detects Cursor's agent working and lets your Mac sleep when it finishes.
macOS sleeps your Mac based on how long since you touched the keyboard or trackpad,
plus the power assertions running processes hold — not on whether Cursor's agent is mid-task, and not
on CPU load either. A Mac pinned at 100% sleeps on the same schedule as one doing nothing, so a long
model wait at near-0% CPU isn't even the reason it happens. 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.
$19/year if you subscribe before September 15 — locked in for as long as you stay subscribed. New subscribers after that pay $29/year. 30-day money-back guarantee — one email, full refund.
Download free 14-day trialThe download is the trial — the full app, free for 14 days, no card needed. Need more Macs? 5-Mac Pack — $129/year, flat.
Same Mac-goes-to-sleep problem, different tool. Each of these guides covers the fix for that agent specifically: