A lid-closed developer workflow for the MacBook

Plenty of developers just want to close the lid and let a long run finish. AI coding agents like Claude Code, Cursor, and Codex have made that habit more common — a refactor, an unattended re-index, or a Codex task can grind for an hour while you are somewhere else. This is the end-to-end picture: a lid-closed workflow that keeps work alive while safety thresholds quietly help reduce risk.
Why the lid is in your way
By default macOS sleeps the moment you shut the lid, which suspends whatever was running.
AI coding agents make that friction more visible. A Claude Code session mid-refactor, a Cursor background agent re-indexing a large codebase, or a Codex CLI task running unattended — all of these stop the instant the Mac sleeps, often right after you walk away.
What you actually want is to treat the MacBook like a small server for a few hours: close it, walk away, and find the work still going, or cleanly stopped, when you come back.
How the calm version works
The idea is one habit, not a checklist you run every time. Start your task, flip keep-running mode on, close the lid, and go.
LidRun detects AI coding agents — Claude Code, Cursor, and Codex CLI — alongside builds, Docker, and Ollama, holding the Mac awake while any of those are working. The active session shows in the menu bar so you always know it is on.
Underneath, every keep-awake decision is gated by battery and thermal state. The Mac keeps your work alive while conditions are fine, and steps down on its own when they are not.
Related guideKeep Claude Code running when your MacBook is closedWho this is for
This workflow pays off if you regularly kick off long jobs and want to move around: between desk and couch, home and a cafe, evening and morning.
AI agent users in particular. If you kick off a Claude Code run before bed, let Cursor re-index a large repo while you cook, or queue a Codex task that takes an hour — closing the lid used to mean gambling on whether it would finish. This workflow changes that.
If you mostly do short, interactive work at one desk, you do not need a lid-closed routine at all. But if the lid is the only reason you are still sitting there, it is worth trying LidRun once — a closed-lid Mac workflow — and letting close-the-lid-and-walk-away become the default.
Setup and habits that make it stick
Set it up once: pick a battery warning level and an auto-sleep level, choose a session timer length, and leave thermal watch on. After that, the only step you repeat is closing the lid.
If charge drops past your critical level, LidRun lets the Mac sleep instead of draining it to zero. If thermal pressure climbs, you see it in the menu bar and cooling profiles respond within what the hardware allows.
Keep two habits: a hard, flat, ventilated surface, and mains power for long jobs. Those do more for a safe lid-closed run than any setting, and they let the software guardrails be a backstop rather than the only line.
LidRun keeps your work running with the lid closed, with battery and thermal safety built in.
Already have LidRun? Read the setup guide →
Frequently asked
LidRun detects Claude Code, Cursor, and Codex CLI, and holds the Mac awake while any of them are running. When the agent finishes and no watched task remains, the session can wind down rather than idling awake.
Yes, with keep-running mode on, as long as battery and thermal state stay within the thresholds you set. When a limit is reached, LidRun lets the Mac sleep.
No. You configure thresholds and the timer once. The repeated step is just closing the lid after you start a task.
LidRun uses battery and thermal thresholds to help reduce risk, but keep the Mac on a flat, ventilated surface and plugged in for long runs.