Close Your MacBook Lid Without Killing Your AI Agents (Open-Source macOS Keep-Awake)
Описание и применение
Awake позволяет продолжать работу MacBook с закрытой крышкой, блокируя экран и автоматически отключая сон при перегреве или низком заряде батареи.
Задача
Closing a MacBook lid on battery or unplugged causes macOS to enter clamshell sleep, dropping SSH sessions, freezing Docker builds, and killing background AI coding agents.
Результат
Awake enables continuous operation with the lid closed, protects against overheating and low battery, and maintains security by locking the screen.
Рабочий процесс
- 1. Install Awake via script or Homebrew.
- 2. Run
awake 2hto keep the Mac awake for 2 hours, orawake -- bun run buildto keep awake until a command finishes. - 3. Awake toggles
pmset -a disablesleep 1andcaffeinate -dimswhile monitoringAppleClamshellState. - 4. On lid close, Awake locks the screen immediately.
- 5. Awake polls
AppleSmartBatteryevery 30s; if temperature ≥40°C or charge ≤10%, it trips a breaker, allows sleep, and auto-resumes when conditions normalize.
Доказательства
Every time you close your MacBook lid on battery or unplug your display to walk to a meeting, macOS enters clamshell sleep. Your SSH sessions drop, your Docker builds freeze, and your background AI coding agents die mid-run.
So I built and open-sourced Awake — a tiny native macOS 26 Control Center widget, Menu Bar timer, and CLI that keeps your MacBook running with the lid closed, locks the screen the instant the lid shuts, and automatically re-enables sleep if the battery temp hits 40°C or drops to 10%.
- Дата записи: 2026-11-03T18:13:48.554Z