Keep a Cursor agent running when you close your MacBook lid.

By Matyas Rathonyi. Updated October 2, 2026. Guides

Cursor keeps the Mac awake while an agent runs, but only with the lid open: closing the lid still sleeps the Mac and pauses local agents.

Cursor editorAgents run on your Mac, pause at lid sleep
Cursor CLIThe agent command pauses too
Cloud AgentsKeep working while the Mac sleeps
No monitorArm Clamshell before closing the lid

Clamshell for Mac keeps the Mac awake with the lid closed while armed. No sudo, no monitor. Free for 7 days, then $9.99 once.

Download free trial
Two places a Cursor agent can run. On a closed, sleeping Mac the local agent is paused. As a Cloud Agent, the task keeps working. On your Mac pauses at lid sleep Cloud Agent keeps working
Where the agent runs decides what the lid does.Agents in the Cursor editor and CLI stop when a closed lid puts the Mac to sleep. Cloud Agents never depended on your Mac being awake.

It depends on where the agent is running. Agents in the Cursor editor and in the Cursor CLI work on your Mac, so they stop making progress when a closed lid puts the Mac to sleep. Cursor does hold a wake lock while an agent is actively running, but a Cursor team member confirmed on the Cursor forum that it cannot override the sleep macOS enforces when you close the lid. Cloud Agents run remotely and keep working while your Mac sleeps. To keep a local Cursor agent going with the lid closed and no external monitor, use Clamshell for Mac, a menu bar app that keeps an Apple Silicon MacBook awake with the lid shut and restores normal lid sleep when you disarm it.

Quick answer

Agent in the Cursor editor

Runs on your Mac. Cursor's wake lock covers idle sleep while the agent works, not lid sleep. Close the lid and it pauses.

Cursor CLI

The agent command, interactive or in print mode with agent -p, runs in your terminal on your Mac. Lid sleep pauses it.

Cloud Agents

Run on Cursor's side. You can hand a CLI conversation to one by starting a message with & and follow it at cursor.com/agents.

Local agent, lid closed, no monitor

Arm Clamshell before you close the lid, or use sudo pmset -a disablesleep 1 and remember to undo it.

Which Cursor agent are you running?

Cursor agents run in different places. Only the ones that run on your Mac care about the lid.

SurfaceRuns onStops on lid sleep?What to do
Agent in the Cursor editor Your Mac Yes, even with Cursor's wake lock Keep the Mac awake with the lid closed
Cursor CLI: agent, agent -p Your Mac Yes Same as the editor
Cloud Agents Cursor's cloud No Nothing on the Mac; check results at cursor.com/agents

If the task can run in the cloud, a Cloud Agent is the simplest fix: nothing on your laptop has to stay awake. Keep reading if the job needs your local files, tools, credentials, simulators or hardware.

Why a local Cursor agent stops at lid close

  1. You close the lidmacOS starts lid sleep, separate from idle sleep.
  2. The wake lock does not block itCursor's wake lock and caffeinate only hold off idle sleep.
  3. The agent stops making progressTerminals, test runners and connections stop too.

A Cursor agent that is busy editing code or running tests keeps an idle Mac awake, because Cursor holds an Electron wake lock while the agent works. Closing the lid is different: it triggers lid sleep, which macOS enforces regardless of that wake lock or of apps like Caffeine. Once the Mac is asleep, the agent, its terminals, test runners and network connections all stop making progress. A Cursor team member described exactly this on the Cursor forum in May 2026, and recommended Cloud Agents for work that must continue with the lid closed.

Ways to run a Cursor agent locally with the lid closed

Clamshell for Mac keeps an Apple Silicon MacBook awake with the lid closed, no monitor needed. Free for 7 days, then $9.99 once for one Mac.

Download free trial

Wrap a Cursor CLI run so it arms and disarms Clamshell

Clamshell accepts clamshell://arm, clamshell://disarm and clamshell://toggle URLs. This wrapper requests arming before a non-interactive Cursor CLI run and requests disarming when the shell exits, so normal lid sleep comes back when the job ends.

set -e
open "clamshell://arm"
trap 'open "clamshell://disarm" || true' EXIT

agent -p "run the test suite and fix the failures" --output-format text \
  | tee cursor-result.md

Read the caveats before you rely on it:

Clamshell also adds Arm, Disarm, Toggle and Status actions to Shortcuts, which you can combine in a shortcut of your own.

Prove that the agent keeps working with the lid closed

Before trusting a long run, spend two minutes on a harmless check.

  1. In a Cursor agent chat, with the lid open, ask the agent to run this command in its terminal and approve it:
    for i in {1..12}; do
      date -u '+%Y-%m-%dT%H:%M:%SZ' >> lid-check.txt
      sleep 10
    done
  2. Confirm Clamshell is armed and close the lid for the two minutes.
  3. Open it and run cat lid-check.txt. Pass: twelve timestamps about ten seconds apart with no gap while the lid was shut.

Fail: a long gap means the run was interrupted; it does not tell you why. Check Clamshell's state, the terminal, and whether the agent was waiting for an approval, fix it with the lid open, and repeat.

What Clamshell does and does not do

Keeps the lid from sleeping

Keeps an Apple Silicon MacBook on macOS 14 or later awake with the lid closed, with the built-in display dark, and locks the Mac when you open the lid.

Watches heat

Watches macOS thermal pressure at all times. At serious or critical pressure it disarms toward normal lid sleep and blocks arming until the Mac cools.

Handles power changes

Works on battery and on power, and re-applies itself when you plug in or unplug. An optional Disarm on low battery threshold is off by default.

Does not manage Cursor

It does not detect Cursor agents, stop when a task finishes, keep the network up, or move work to the cloud.

Arming with Option held while you close the lid needs the lid angle sensor in a MacBook Air M2 (2022) or later or a 14-inch or 16-inch MacBook Pro (2021) or later; other Apple Silicon laptops arm from the menu bar. Option-close sessions end when you open the lid; menu and URL arming stays on until you disarm.

Frequently asked questions

Does a Cursor agent keep running when I close my MacBook lid?

Cloud Agents do, because they run on Cursor's infrastructure. Agents in the Cursor editor and the Cursor CLI run on your Mac, so closing the lid puts the Mac to sleep and pauses them, unless an external display setup, pmset disablesleep, or a lid-sleep tool such as Clamshell keeps the Mac awake.

Doesn't Cursor already keep my Mac awake while an agent runs?

Only with the lid open. A Cursor team member explained on the Cursor forum in May 2026 that Cursor holds an Electron wake lock while an agent is actively running, but that it cannot override the sleep macOS enforces when you close the lid.

Does Caffeine or caffeinate keep a Cursor agent running with the lid closed?

No. They prevent idle sleep only. Lid-close sleep is a separate path they do not block, so a local Cursor agent still pauses when the lid closes.

Do I need to keep my Mac awake for Cursor Cloud Agents?

No. Cloud Agents run remotely, and you can pick their results up on the web or on your phone at cursor.com/agents. From the Cursor CLI you can hand a task to a Cloud Agent by starting a message with an ampersand.

Does Clamshell stop automatically when the Cursor agent finishes?

No. Clamshell does not detect Cursor or any other agent. To end the session when a job ends, wrap the job in a script that opens clamshell://disarm on exit, or disarm from the menu bar.

Can a Cursor agent keep running on battery with the lid closed?

Yes, if the Mac stays awake. Clamshell works on battery, and you can enable Disarm on low battery so the Mac goes back to normal sleep below a charge level you choose. For long runs, plug in and keep the Mac on a ventilated surface.

Related guides

Sources checked October 2, 2026: Cursor's CLI documentation and a Cursor team reply on the Cursor forum (May 6, 2026). Clamshell behavior is described from its app source and FAQ. No new hardware testing was done for this page. Clamshell is an independent app, not affiliated with or endorsed by Anysphere. Cursor is a trademark of its owner.