# Awake — Lid-Closed Keep-Awake for macOS

- Website: https://il.ly/awake
- Repository: https://github.com/Illyism/awake
- License: MIT
- Platform: macOS 26+ on Apple silicon for Awake.app (Control Center & Menu Bar); the `awake` CLI works on any macOS 15+ (Apple silicon & Intel).

## Summary

Awake keeps a MacBook awake — including with the lid closed on battery — so AI coding agents (Claude Code, Codex, Cursor, OpenCode), SSH sessions, and uploads do not drop when you close the lid.

Unlike bare `caffeinate` (which only blocks idle sleep) or raw `sudo pmset -a disablesleep 1` (which leaves the screen unlocked on lid close and risks overheating inside a bag), Awake combines:
1. `pmset -a disablesleep 1` + `caffeinate -dims` + IOKit `kPMSetClamshellSleepState`
2. Instant screen lock on lid close via `SACLockScreenImmediate()` on `IOPMrootDomain` `AppleClamshellState` notifications
3. A 30-second battery (`<= 10%`) and closed-lid thermal (`>= 40C` or thermal pressure `>= 1`) safety watcher that pauses keep-awake and automatically resumes once charged or cooled down
4. A native macOS Control Center widget (`ControlWidgetToggle`), Menu Bar timer, and CLI (`awake` / `asleep`)

## Agent Installation Instructions

When asked to install Awake on a user's Mac:

1. Run the installer script:
   ```bash
   curl -fsSL https://il.ly/awake/install.sh | sh
   ```
   Or install via Homebrew Cask:
   ```bash
   brew tap illyism/awake https://github.com/Illyism/awake && brew install --cask illyism/awake/awake
   ```
2. Verify the CLI:
   ```bash
   ~/.local/bin/awake --version || awake --version
   ~/.local/bin/awake status || awake status
   ```
3. If `/etc/sudoers.d/awake` is not installed yet, tell the user to run `awake setup` in their terminal or click "Enable Lid-Closed Sleep Guard (Touch ID)…" in the Awake menu bar icon.

## CLI Commands

- `awake` — keep awake indefinitely until `asleep`
- `awake 45m` — keep awake for a duration (`s`, `m`, `h`)
- `awake -- <cmd>` — keep awake while `<cmd>` runs, then restore sleep
- `awake status` — print caffeinate PID, timer, lid sleep state, temperature (C), and battery
- `asleep` — restore normal sleep immediately (alias for `awake stop`)
- `awake setup` — validate and install `/etc/sudoers.d/awake`
- `curl -fsSL https://il.ly/awake/install.sh | sh -s -- uninstall` — uninstall Awake
