For Cursor
How do I keep my Mac awake while Cursor's agent works?
Short answer
Cursor's editor keeps the Mac awake while an agent is running, through an Electron wakelock, but Cursor says it can't override the sleep macOS forces when you close the lid. The Cursor CLI doesn't manage sleep at all. Night Crew adds a hook so local Cursor agents keep the Mac awake, lid open or closed, with battery and heat guards.
What Cursor already does about sleep
In the editor. Asked on Cursor’s forum for an option to stop sleep while an agent runs, Kevin Neilson of Cursor replied: “Cursor does keep the system active when there’s an agent actively running (via an Electron wakelock)”. He added that it “can’t override the Mac OS enforced behavior when you close your screenlid”, and pointed to Cloud Agents for lid-closed work (6 May 2026).
In the CLI. On a second thread, Cursor’s Dean Rie wrote: “Right now the standalone CLI doesn’t manage system sleep
on its own” (16 July 2026). His suggestion for macOS was to run caffeinate -i next to the agent:
caffeinate -i agent
That holds off idle sleep until the command exits, including while the agent sits waiting for you.
Where that falls short
- The lid. Closing the lid is forced sleep. Apple says “it is not possible to prevent forced sleep, only delay it” (QA1340). Cursor says the same of its wakelock.
- The CLI. Nothing holds the Mac awake unless you wrap the command yourself.
- Battery and heat. Neither reply mentions battery level or heat.
- Your machine or theirs. Cloud Agents solve the lid, but the work then runs on Cursor’s servers, not on your Mac.
What Night Crew adds
- A one-click hook. Night Crew adds a small hook to Cursor’s hooks file, so it sees when you send a prompt, when a tool or shell command finishes, when the agent responds and when it stops. It stays out of the hooks Cursor uses to approve or block a tool or shell command.
- Awake only while it works. When the agent stops, Night Crew waits 60 seconds, then lets the Mac sleep. A build the agent leaves running keeps the Mac up for at most 2 hours.
- Lid mode. Close the lid and the local agent keeps working. It’s on the charger only by default, and you approve a small helper once in System Settings.
- Guards. A battery floor at 15% (30% in lid mode on battery), a heat guard that’s always on in lid mode, and a 24-hour cap.
Cursor’s docs say the same hooks file serves the editor’s agent sessions. They don’t say whether every hook also fires in the CLI, so we don’t promise CLI coverage yet.
How to set it up
- Download Night Crew and open it.
- Open Settings › Agents and click set up next to Cursor. Night Crew backs up
~/.cursor/hooks.jsonfirst, adds its entries next to any hooks you have, and keeps the three newest backups. - Start an agent in Cursor. The Agents pane shows the hook’s last event, so you can see it working.
To remove it, use the same row: one click and a confirm. Closing the lid is covered in more depth in Can I close my laptop while an agent runs?, and other keep-awake apps are on /compare.
Questions
Can a Cursor agent keep running with the lid closed?
Not by default. Cursor's wakelock stops idle sleep, but closing the lid forces sleep, which apps can't prevent. Cursor points people to Cloud Agents for lid-closed work. If you want the agent on your own Mac, Night Crew's lid mode keeps a closed Mac running while it works, on the charger by default.
Is Cloud Agents a better choice?
Sometimes. Cloud Agents run on Cursor's servers, so your Mac can sleep, travel or switch off. Local agents still make sense when the work needs your machine: local services, private files, your own toolchain. Night Crew is for that local case.
Can Night Crew's hook get in the way of my Cursor agent?
It's built not to. Cursor's permission hooks run before a tool, shell command or MCP call and can block it, so Night Crew doesn't use them. It listens for events such as prompt sent, tool finished, response written and stop, and its hook exits within a second.
Sources
- Cursor forum: disable sleep while an agent is running (Electron wakelock, lid)
- Cursor forum: caffeinate for the Cursor CLI
- Cursor docs: hooks
- Apple QA1340: idle sleep vs forced sleep
- caffeinate man page (ss64)
Checked 5 November 2026.