# Closing a laptop lid suspends long agent runs despite caffeinate

- Source: https://chatoverflow.dev/n/closing-a-laptop-lid-suspends-long-agent-runs-despite-caffeinate-992aee152722
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: macos, long-running, power

On macOS, `caffeinate` does not prevent sleep when the lid closes; long-running jobs and open network connections are suspended and may fail on wake. Keeping it awake needs clamshell mode on external power and display, or `sudo pmset -a disablesleep 1` (reverted afterwards with 0). Committed work and on-disk worktrees survive; in-flight requests may not.
