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.
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.
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.
| Surface | Runs on | Stops 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):
- Cloud Agents have limits of their own. They clone from GitHub, GitLab, Azure DevOps Services or Bitbucket Cloud, need read-write access to the repo, work on a separate branch, require a paid Cursor plan and are billed at API pricing for the model you select. The Cloud Agents page also notes that the VM cannot see your local home directory, so anything that only exists on your Mac is out of reach.
- Projects can reach back to your laptop. The Projects announcement (September 10, 2026) says "closing your laptop doesn't stop it", and adds that when something needs testing on your machine the coordinator starts a local agent there. That local step is subject to the lid like any other.
- Remote Control is not a cloud run. Cursor's Remote Control announcement (October 6, 2026) says it "doesn't move your agents anywhere", and the iOS documentation puts it bluntly: "Tool calls can't run while your computer is asleep or offline."
Why a local Cursor agent stops at lid close
- The lid goes downmacOS sleeps the whole machine, whatever apps are busy.
- Cursor's keep-awake gives wayIts wake lock and its setting are built for an open lid.
- 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.
- The automatic wake lock. In a Cursor forum thread asking for a sleep option, a reply dated May 6, 2026 from Kevin Neilson, who carries the Cursor staff badge there, says Cursor keeps the system active while an agent is running "via an Electron wakelock" and that it "can't override the Mac OS enforced behavior when you close your screenlid". This is a forum post, not documentation, and I could not find the wake lock described anywhere in Cursor's docs.
- The "Keep this computer awake" setting. This is the only named setting, and it arrived with Remote Control. The changelog places it "under Remote Control in Cursor's desktop settings" and states the condition directly: "Your computer needs to be plugged in with the lid open." The iOS documentation locates the same toggle under Settings > Agents in the Agents Window, says it prevents sleep "while the computer is plugged in", and requires Cursor 3.9.8 or later. Both pages checked October 11, 2026.
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
- Leave the lid open and use Cursor's setting. Plugged in, with "Keep this computer awake" on, the Mac stays up and you can follow along from the iOS app. Free, supported by Cursor, and useless in a backpack.
- Dock it. macOS keeps running with the lid shut when an external display, keyboard, pointing device and power are attached. Fine at a desk.
sudo pmset -a disablesleep 1. A system-wide admin switch that stays set until you reverse it. Read what it changes and the undo command first.- Clamshell. A menu bar app that keeps the Mac awake with the lid closed only while you have it armed, without an admin password, and hands lid sleep back when you disarm, quit or restart.
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
Three things this script cannot do for you:
- Confirm that arming worked. Clamshell refuses while macOS reports serious thermal pressure, and
openstill returns success. - Survive a force quit. If the terminal is killed, the trap never fires and Clamshell stays armed until you disarm it from the menu bar.
- Grant Cursor permissions. What print mode may write or execute comes from your CLI permission settings and flags, as covered above.
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.
- Note when the run started and ended. With the script above,
cat cursor-run.logshows both. In the editor, use the time you sent the prompt and the time you came back. - Print the Mac's recent sleep and wake events:
pmset -g log | grep -E "Entering Sleep|Wake from" | tail -20 - Compare. Ran straight through: no
Entering Sleepline is timestamped between your start and end. Paused: there is one, and the nextWake fromline 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
- How to keep a MacBook awake with the lid closed
- Use Codex from your phone with the lid closed
- Run AI coding agents overnight on a MacBook
- Keep Claude Code running with the lid closed
- Keep Codex running when you close your MacBook lid
- Why caffeinate does not work with the lid closed
- Compare Clamshell, Amphetamine, pmset and Apple's setup
- Computer use and iOS Simulator with the lid closed
- Best apps to keep a MacBook awake with the lid closed
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.