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.
caffeinate -dims only prevents idle sleep while the lid is open. To keep a MacBook running with the lid closed, macOS requires toggling pmset -a disablesleep 1 at the kernel power management layer—which is risky if you forget it on and throw your laptop into a backpack.
So I built and open-sourced Awake (il.ly/awake) — a tiny native macOS 26 Control Center widget, Menu Bar timer, and CLI (awake / asleep) 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%.
What It Does
-
Works with the lid closed on battery or AC: Combines
pmset -a disablesleep 1withcaffeinate -dimsand live IOKitAppleClamshellStatemonitoring. - Instant screen lock on lid close: The moment the lid closes while Awake is active, it locks your session so an awake MacBook is never an unlocked MacBook.
-
Backpack thermal & battery circuit breaker: Polls
AppleSmartBatteryevery 30 seconds in-process via IORegistry. If battery temperature reaches >= 40°C (like inside a closed sleeve or backpack) or charge drops to <= 10%, Awake immediately trips the breaker and lets the Mac sleep, then auto-resumes once cooled or plugged in. -
macOS 26 Control Center + Menu Bar + CLI: Toggle from Control Center, pick a countdown timer (
30m,1h,2h,4h, or indefinite) from the Menu Bar espresso cup, or wrap a long command from the terminal:
# Install via script or Homebrew
curl -fsSL https://il.ly/awake/install.sh | sh
# or: brew install --cask illyism/awake/awake
# Keep awake for 2 hours
awake 2h
# Keep awake until a specific command finishes
awake -- bun run build
Links
- GitHub Repository (MIT): github.com/Illyism/awake
- Interactive Overview & DMG Download: il.ly/awake

Top comments (0)