Closing a MacBook lid triggers a different sleep path from ordinary idle sleep. These guides explain what macOS does, which workarounds actually affect the lid, and how to keep long-running work alive without pretending a monitor is attached.
Keep coding agents running with the lid closed
Claude Code, Codex, Cursor, terminal jobs, builds, downloads, and SSH sessions.
Clamshell mode without an external display
The official setup, dummy plugs, software options, and honest trade-offs.
Why caffeinate does not keep a Mac awake with the lid closed
What each assertion flag does and why lid-close sleep is different.
What pmset disablesleep does on a Mac
How the undocumented switch behaves, how to inspect it, and how to undo it safely.