Which app keeps a Mac awake for AI agents with the lid closed?

By Matyas Rathonyi. Published November 23, 2026. Guides

No built-in agent setting or open-lid utility keeps your AI coding agent running when you close your laptop: without an external monitor, macOS puts a closed MacBook to sleep and stops local runs until you open it again. To keep AI agents running with the lid closed and no monitor, you need a lid-closed app, and Clamshell for Mac keeps an Apple Silicon MacBook awake on power or battery with no admin password, no sudo and nothing to undo, for $9.99 once after a 7-day free trial.

Written by Matyas Rathonyi, the maker of Clamshell for Mac.

Two closed MacBooks running an agent. With nothing set up, Apple documents closing the lid as a way to sleep a Mac laptop. With a lid-closed app armed, the Mac stays awake. z Nothing set up Mac sleeps Lid-closed app while armed
The lid decides, not the agent. Apple documents closing the lid as a way to sleep a Mac laptop. A lid-closed app keeps it awake while it is armed or while it sees an agent working.

The free fixes, and where they stop

If you can leave the laptop open, macOS already gives you a free command. On macOS 27.2.1, man caffeinate documents -i to prevent idle sleep while a command runs:

caffeinate -i <command>
caffeinate -i -t <seconds>
caffeinate -i -w <pid>
pmset -g assertions

At a desk with an external monitor, power, keyboard and mouse connected, Apple's own setup (Apple Support 102501) also keeps a closed MacBook awake at no cost.

Both free routes stop the moment you close your laptop without a monitor:

Why choose Clamshell for closed-lid agent runs

If you want to close your laptop, walk away and come back to finished work without handing over an admin password or managing terminal flags, Clamshell is built for that job:

Try it on your next agent run before paying anything: Download free trial (free for 7 days, no card required; $9.99 once for 1 Mac or $19.99 for up to 3 Macs, with a 14-day money-back guarantee).

Closed-lid apps for AI agents side by side

Here is how Clamshell compares with three closed-lid apps that readers meet most often when running coding agents on a Mac, from each maker's own page as checked on November 23, 2026:

ClamshellAmphetamineKeepressoLidRun Pro
Closed lid, no monitorYes, power or batteryYes; plug/unplug ends it without Power ProtectYes, power or batteryYes, Pro tier only
Admin stepNone to stay awakeNone, or admin for Power ProtectAdmin password or helperNeeds admin authorization
Price$9.99 once (1 Mac)FreeFree (GPL-3.0)$9.90 launch (1 Mac)
Agents followed5 agents plus URL schemeNone (app triggers only)19 named agents plus hooksClaude Code, Codex, Cursor, Ollama
Mac and macOSApple Silicon, macOS 14+macOS 10.13+macOS 14+Apple Silicon and Intel, macOS 13+
Free trial7 days, no cardFree appFree, open sourceFree tier (lid open only)

Verdict: Choose Clamshell if you want closed-lid agent runs on an Apple Silicon MacBook with no admin password or helper; choose Keepresso or LidRun Pro if you have admin rights and want wider agent detection, open-source code or Intel support.

What the free closed-lid apps ask of you

Free apps can keep a closed MacBook running an agent, but each asks for an admin step or drops the run when the power changes:

Why pay $9.99 once for Clamshell? You skip admin passwords, sudoers files, privileged helpers and macOS 26 version floors while getting always-on heat protection, a 20% battery stop and normal lid sleep back when you disarm or quit.

When another app is the better pick

Frequently asked questions

Do AI coding agents' own keep-awake settings keep running when I close my laptop?

No. Anthropic's Claude desktop docs say closing the laptop lid still puts it to sleep, OpenAI's Prevent sleep while running setting has no lid wording, OpenClaw's docs say closing a Mac laptop lid forces sleep, and VS Code 1.148's preview setting explicitly excludes closing the lid. To keep local runs going with the lid closed, use a lid-closed app like Clamshell.

Does caffeinate keep an AI agent running with the lid closed?

Not by its manual. Apple's macOS 27.2.1 caffeinate manual documents -i for idle sleep and -s for system sleep on AC power only, and says nothing about closing the lid. For unattended overnight runs with the lid closed, use a dedicated lid-closed app instead.

Why pay $9.99 for Clamshell when free lid-closed apps exist?

Each free lid-closed app above asks for an admin step before it holds a run through power changes: Amphetamine's Power Protect sudoers file, Keepresso's administrator password or helper, or Adrafinil's privileged helper. Clamshell costs $9.99 once with no subscription so you can keep a closed Apple Silicon laptop running with no admin password, always-on thermal safety and a 20% battery floor. Start the 7-day free trial to test it on your own workflow first.

Do I need admin rights to keep a closed Mac running AI agents?

Not with Clamshell: it keeps a closed Apple Silicon MacBook awake with no sudo or admin password. sudo pmset -a disablesleep 1, Keepresso and Adrafinil need admin rights, and Amphetamine needs them to keep a session through plugging in or unplugging. If you are on a work laptop, see how to keep a work MacBook awake without admin rights.

What if I run OpenClaw or GitHub Copilot in VS Code, or want an overnight checklist?

For tool-specific behavior, read will OpenClaw keep running if you close your MacBook and will GitHub Copilot in VS Code keep running if you close your laptop. For heat, power and network checks before leaving agents overnight, read how to run AI agents overnight on a MacBook, or compare MacBook vs Mac mini for AI agents.

Try Clamshell free for 7 days

Close your laptop and let your AI agents finish their work, with no admin password, an always-on heat cut-off and a 20% battery floor. Normal lid sleep returns when you disarm or quit.

Download free trial $9.99 once, no subscription

$9.99 for 1 Mac, $19.99 for up to 3 Macs. 7-day free trial with no card required and a 14-day money-back guarantee. Apple Silicon, macOS 14 or later, notarized by Apple. Also available via Homebrew or Setapp.

Sources checked November 23, 2026: Apple Support article 102501, the macOS 27.2.1 caffeinate(8) manual, Anthropic's Claude desktop and Claude Code documentation, OpenAI's ChatGPT desktop settings and Codex config reference, OpenClaw documentation, the VS Code 1.148 test plan (microsoft/vscode#349545), and the product pages, GitHub repositories and App Store listings of Amphetamine (and Power Protect), Keepresso, Adrafinil, LidRun, KeepingYouAwake and Lungo. Every detail about rival apps comes from their own pages on that date. Clamshell details come from version 2.0.5. Product names belong to their respective owners.