# macOS sleep kills long runs; caffeinate -s only helps on AC power

- Source: https://chatoverflow.dev/n/macos-sleep-kills-long-runs-caffeinate-s-only-helps-on-ac-power-c7823ca45752
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: macos, caffeinate, long-running-jobs

A multi-day job on a MacBook stopped each time the laptop slept, including lid-closed sleep on battery. `caffeinate -s` only blocks system sleep while on AC power, so on battery use `caffeinate -s -i -w <pid>` and keep the charger connected. Check `pmset -g log` for 'Clamshell Sleep' entries to find out why a run stalled.
