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

By Matyas Rathonyi. Updated October 11, 2026. Guides

If the task lives in a Git repository, the first answer is a Cursor Cloud Agent: it works in a virtual machine on Cursor's side, so your MacBook can be shut, asleep or offline. Agents in the editor, the Agents Window and the agent CLI use your Mac, and they pause the moment a closed lid sleeps it. Cursor's own keep-awake option only applies with the lid open.

Cloud AgentsRun in Cursor's cloud, lid does not matter
Editor and CLIRun on the Mac, pause at lid sleep
Cursor's setting"Keep this computer awake": plugged in, lid open
Lid shut, localNeeds a lid-sleep override such as Clamshell

An animated MacBook with a coding agent deploying a website from its terminal. The Option key is held and the lid closes: the display goes black, but the Mac stays awake, so a dimmed copy of the terminal keeps working above the closed laptop while its front edge fills with light. When the deploy is done, a pointer shows how to lift the lid. Opening it wakes the Mac to its lock screen, which unlocks to the finished run: deployed, with the live address. The lid can then be opened and closed freely.

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.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell. On your phone? Send the Mac download link to yourself.

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. z On your Mac pauses at lid sleep Cloud Agent keeps working
Same prompt, two different computers.A Cloud Agent edits a clone of your repository on a remote machine. An editor or CLI agent edits the files on your disk, so it can only move while macOS is awake.

Cursor's documentation describes Cloud Agents (called Background Agents until the rename) as running "in isolated VMs in the cloud" and says they "do not require your local machine to be connected to the internet" (checked October 11, 2026). That makes them the right tool for anything a fresh clone of the repo can do. The rest of this page is for the jobs a clone cannot do: work that depends on files that are not pushed, a local database, a signed-in toolchain, a simulator, or hardware plugged into the Mac.

Quick answer

The repo is on GitHub, GitLab, Azure DevOps or Bitbucket

Pick Cloud in the dropdown under the agent input, or start the task at cursor.com/agents. Close the laptop. The agent pushes a branch when it is done.

You are already mid-conversation in the CLI

Start your next message with &. Cursor's CLI docs say this pushes the conversation to a Cloud Agent so it can "keep running while you're away".

The job needs this Mac, and the lid can stay up

Plug in, switch on Cursor's Keep this computer awake, dim the screen and steer from the iOS app with Remote Control.

The job needs this Mac, and the lid must close

Nothing inside Cursor covers this. Use an external display, pmset, or a lid-sleep app such as Clamshell.

Which Cursor agent are you running?

Cursor now has five places an agent can show up. Two of them ignore your lid. Three do not.

SurfaceRuns onStops on lid sleep?What to do
Cloud Agents A VM in Cursor's cloud, on a clone of your repo No Review the branch or pull request at cursor.com/agents
Projects (beta) "Its own computer in the cloud" No, except steps it sends to a local agent Keep the Mac awake only if it tests on your machine
Agent in the editor or Agents Window Your Mac Yes Move it to the cloud or override lid sleep
Cursor CLI: agent, agent -p Your Mac, inside your terminal Yes, tmux included Send it to the cloud with & or override lid sleep
Remote Control from the iOS app Tool calls on your Mac Yes Lid open and plugged in, or override lid sleep

Three details from Cursor's pages are worth knowing before you choose (all checked October 11, 2026):

Why a local Cursor agent stops at lid close

  1. The lid goes downmacOS sleeps the whole machine, whatever apps are busy.
  2. Cursor's keep-awake gives wayIts wake lock and its setting are built for an open lid.
  3. Every tool call freezesShell commands, edits and model requests wait for wake.

Cursor has two sleep-prevention behaviours, and neither one is a lid override.

So on battery, or with the lid shut, Cursor itself has nothing that holds the Mac awake. That is by design on Cursor's side: its answer for closed-laptop work is the cloud.

Five Cursor situations, and what the lid does to each

The agent is waiting for your approval

An agent parked on an approval prompt is doing nothing, awake or asleep. Keeping the Mac awake does not click the button. Before leaving, open Settings > Agents > Approvals & Execution and look at the Run Mode. Cursor's Run Modes page lists three: Auto-review (sandboxes what it can and has a classifier review the rest), Allowlist, and Run Everything, where "every tool call runs automatically". Auto-review can still raise a prompt, and Cursor warns that its classifier can make mistakes, so pick the mode for the risk you accept, not for convenience. Cursor's docs do not say how long an agent waits on an unanswered prompt.

The Cursor CLI in a terminal

Interactive agent asks you to approve (y) or reject (n) each terminal command, according to the CLI usage docs, so an unattended interactive session usually stalls at the first command. Print mode (agent -p) is the unattended form: the docs state that "Cursor has full write access in non-interactive mode", and the permissions reference says to use permissions.allow, permissions.deny and --force to decide what runs without prompts. Set those deliberately before you walk away.

The CLI inside tmux

tmux protects a session from a closed terminal window or a dropped SSH connection. It does not protect it from sleep, because the tmux server is a process on the same sleeping Mac. Cursor's CLI docs mention tmux only for a keyboard shortcut. After wake the pane is still there; whether the agent's in-flight request recovered is something you have to read off the screen.

Commands in the integrated terminal

Cursor's terminal documentation says the agent "runs shell commands directly in your terminal", sometimes inside a sandbox depending on the Run Mode. Either way the process is local. A test suite, a build or a dev server the agent started is frozen for exactly as long as the Mac sleeps, and anything with a network timeout may fail on wake.

A long-running command with a remote end

Database migrations, deploy scripts, large uploads and package installs are the risky ones, because the far side keeps its own clock while your Mac is stopped. If a command like that must not be interrupted, either run it in a Cloud Agent or make sure the Mac cannot sleep before you start it. I could not confirm from Cursor's docs how the agent treats a command that was suspended mid-run, so treat the result as suspect and re-run it.

What to do when the run has to stay on this Mac

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.

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or install with Homebrew: brew install --cask clamshell.

Wrap a Cursor CLI run so it arms and disarms Clamshell

Print mode pairs well with Clamshell's URL scheme. The script below asks Clamshell to arm, stamps the start and end time into a log, and asks it to disarm when the script ends, whether agent succeeded or not. The two timestamps are what make the after-the-fact check in the next section possible.

#!/bin/zsh
open "clamshell://arm"
trap 'open "clamshell://disarm"' EXIT

date "+start %F %T" > cursor-run.log
agent -p "run the test suite and fix the failures" \
  --output-format text >> cursor-run.log
date "+end   %F %T" >> cursor-run.log
The wrapper requests arming, runs the Cursor CLI while the lid is closed, then requests disarming when the shell exits. $ open clamshell://arm $ agent -p "run the tests" lid closed, still working job done, shell exits trap: open clamshell://disarm
The script brackets the agent. Look at the menu bar icon after the first line runs and before you shut the lid: the URL is a request, and Clamshell may decline it.

Three things this script cannot do for you:

On the Setapp build, replace the scheme with clamshell-setapp://. If you prefer Shortcuts, Clamshell ships Arm, Disarm, Toggle and Status actions.

How to tell afterwards whether the run paused

Cursor does not show a "your Mac slept" marker in the conversation, as far as its docs describe. macOS does keep a record, and it takes one command to read.

  1. Note when the run started and ended. With the script above, cat cursor-run.log shows both. In the editor, use the time you sent the prompt and the time you came back.
  2. Print the Mac's recent sleep and wake events:
    pmset -g log | grep -E "Entering Sleep|Wake from" | tail -20
  3. Compare. Ran straight through: no Entering Sleep line is timestamped between your start and end. Paused: there is one, and the next Wake from line tells you when work could resume. The gap between the two is time the agent lost.

If it paused, reopen the conversation before trusting the result. In the CLI, agent resume returns to the latest conversation and agent ls lists earlier ones. Check whether the last command finished, and re-run anything that was talking to a server when the Mac went down. Try the whole routine once on a five-minute task before you rely on it overnight.

What Clamshell does and does not do

Clamshell is a standalone menu bar app for Apple Silicon MacBooks on macOS 14 or later, not a Cursor add-on. While armed, the Mac stays awake behind a closed lid with the built-in screen black, on charger or battery, and it locks when you open it. It cannot see Cursor, so it will not notice an agent starting, finishing or waiting on a prompt; you arm and disarm it yourself or from a script. It stands down on its own when the Mac gets too hot. Requirements, safety behaviour and pricing are in What is Clamshell for Mac?

Frequently asked questions

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

A Cloud Agent does, because it runs in a virtual machine in Cursor's cloud and does not need your Mac to be online. An agent in the Cursor editor, the Agents Window or the Cursor CLI runs on your Mac, so it pauses when the closed lid puts the Mac to sleep.

Does Cursor have a setting that keeps my Mac awake?

Yes, one. Cursor's Remote Control feature includes a setting called Keep this computer awake. Cursor's changelog says the computer needs to be plugged in with the lid open, so it does not cover a closed lid or battery power. Separately, a Cursor forum reply from May 2026 says Cursor holds an Electron wake lock while an agent is running and that it cannot override lid-close sleep.

Can I move a local Cursor agent to the cloud before I close the laptop?

From the Cursor CLI, yes: start a message with an ampersand and the conversation is pushed to a Cloud Agent, which you can pick up at cursor.com/agents. The Cloud Agent works on a clone of your repository from GitHub, GitLab, Azure DevOps or Bitbucket, so it cannot use files or tools that exist only on your Mac.

Does Cursor Remote Control work with the MacBook lid closed?

Not by itself. Remote Control lets you direct an agent from the Cursor iOS app, but the tool calls still run on your computer, and Cursor's documentation says they cannot run while the computer is asleep or offline. The Mac has to stay awake by some other means if the lid is shut.

Does tmux keep the Cursor CLI running after I close the lid?

No. tmux keeps a session alive when the terminal window closes or an SSH connection drops. It does not prevent sleep, and the tmux server sleeps along with every other process on the Mac. The session is still there after wake, but no work happened in between.

How can I tell whether my Mac slept during a Cursor agent run?

Run pmset -g log in Terminal and filter for the lines containing Entering Sleep and Wake from. If an Entering Sleep entry falls between the time the run started and the time it ended, the Mac slept and the agent was paused for that stretch.

Does Clamshell know when a Cursor agent has finished?

No. Clamshell has no Cursor integration, and its core does not detect agents. It keeps the Mac awake with the lid closed until you disarm it, or until a script opens the clamshell://disarm URL.

Related guides

Cursor sources, all read on October 11, 2026: the Cloud Agents, Cursor for iOS, Run Modes, Terminal, CLI usage and CLI permissions docs, the changelog entries for Remote Control (October 6, 2026) and Projects (September 10, 2026), and one forum reply (May 6, 2026). The sleep log command was run on a MacBook on macOS the same day; the lid-closed Cursor runs themselves were not re-tested for this update. Clamshell is an independent product with no connection to Anysphere, and Cursor is its owner's trademark.