Pi was still working.
Your Mac didn't care.

If macOS went to sleep mid-task, Pi — the open-source terminal coding agent — froze right where it was. It didn't fail; it got paused along with your Mac. Here's why that happens, and how to stop it.

To keep your Mac awake while Pi runs: the free way is macOS's built-in caffeinate — start your session as caffeinate -i pi and the Mac can't idle-sleep until the agent exits. The automatic way is AgentBarista (14-day free trial, then $19 one-time), which watches for real agent activity and lets your Mac sleep once the work is done — though Pi only went into its agent list on 27 July 2026 and isn't verified on real hardware yet, so for a long unattended Pi run today the caffeinate line is still what we'd point you at. Details below.

The direct answer

Why your Mac sleeps while Pi is still going

Pi spends most of a task waiting on a model response — which barely uses any CPU. macOS only looks at CPU and user input to decide whether to sleep, so an agent that's "thinking" hard but computing little looks idle to the OS. After your screen-sleep or system-sleep timer runs out, macOS suspends the Mac, and the pi process is frozen along with everything else until you wake it back up.

This bites hardest exactly where Pi is meant to shine: a long agent loop left to grind through a refactor, a session pointed at a slow reasoning model, or a run you kicked off and walked away from. Pi lets you point it at whichever provider and model you like, so the model-wait gap is yours to choose — and a big reasoning model can think for minutes at near-zero local CPU. The fix is to stop macOS from sleeping for as long as the agent is actually running — then let it sleep normally again once the run is done. You can do that for free in two minutes, or with a tool that watches for real agent activity so you don't have to babysit it.

The free option

Free tools can keep your Mac awake too

If you only run Pi occasionally, you don't need to buy anything. Because Pi is a terminal agent, the cleanest free fix is one command:

  • The built-in caffeinate command. Launch your session as caffeinate -i pi instead of pi. The Mac can't idle-sleep while the agent runs, and the moment Pi exits, normal sleep is allowed again — nothing to remember to undo. Already on your Mac, free. For a one-shot or scripted run, wrap the whole command the same way: caffeinate -i pi -p "your prompt".
  • Amphetamine (free, Mac App Store). A menu-bar toggle to keep the Mac awake on a timer or while your terminal app is open — handy if you'd rather flip a switch than type a command.

Both are a fine choice if Pi runs for a few minutes here and there. The catch: neither one knows when the agent actually finished a task versus when it's just sitting at an idle prompt. You either stop it yourself, or it keeps your Mac awake — and your battery draining — long after the work is done.

The purpose-built option — honest status

What AgentBarista does today for Pi

Straight answer, with the parts that aren't finished left in. Pi went into AgentBarista's agent list on 27 July 2026, the same week we noticed it — so it's recognised out of the box, no custom setup. That covers both ways people install it: the standalone binary, where macOS reports the process as pi, and the npm install, where it runs through Node and the process shows up as node instead. Recognising Pi isn't the whole job, though. To hold your Mac awake we need a signal that work is actually happening, and for Pi today that means either real CPU load or the on-screen text of your terminal — and reading that text needs the macOS Accessibility permission. We have not yet added a session-file signal for Pi, which is the thing that catches a long, silent model wait at near-zero CPU. And we haven't sat down at a Mac with Pi installed and confirmed all of it end to end.

Recognised out of the box

Pi is in the built-in agent list — you don't add it yourself, and the Node-hosted process shape is handled. That part needs no permission.

The gap we'd rather name

Long model-wait turns burn almost no CPU. Without a session-file signal, catching those depends on the on-screen text, which needs Accessibility. Both are on the list; neither is verified on hardware yet.

Meanwhile, the free fix still wins

Until that's confirmed, caffeinate -i pi is the honest recommendation for a long unattended Pi run. It costs nothing and we'd rather say so.

Pi (in the list, verification pending) Claude Code Cursor Codex Gemini CLI Copilot CLI OpenCode Zed Antigravity Claude ChatGPT + more

It runs on your Mac. AgentBarista never opens your files. To tell a working agent from a finished one it looks at process command lines and CPU, at the names and modification times of your agents' session files, and — only if you grant macOS Accessibility permission — at the on-screen text of the agent apps you enable and of the terminals we support. Two of those can contain your own words: a command line includes any prompt you pass on it, and on-screen text includes whatever is visible in that window, your code included. Both are matched against status phrases on your Mac and discarded on the spot: never stored, never sent. Nothing about your work leaves your Mac — no file contents, no code, no prompts, no file names, no activity data. Your stats and settings stay on this Mac. The app contains no analytics or telemetry of any kind. Its one network call is license validation, sent to our payment provider, Lemon Squeezy: activating a license sends your license key and your Mac's name, and the routine check after that sends your license key and an anonymous instance id — nothing else.

Pricing

Try it free, then keep it. No subscription.

Pro, one-time
$19 once
  • 14-day free trial, no card needed
  • $15 founding price for the first 200 customers
  • Includes 1 year of updates
  • Lifetime option: $39 once, updates forever
Get notified at launch

Not live yet — leave your email and we'll ping you the moment it is.

Running agents across a team instead? See team pricing.

More agents

Also running Claude Code, Codex CLI, or another agent?

Same Mac-goes-to-sleep problem, different tool. Each of these guides covers the fix for that agent specifically: