awake.crafter.run

macOS 13+ · free · MIT

Keep your Mac awake with the lid closed.

macOS force-sleeps a laptop the moment the lid closes, no matter what caffeinate says. awake wraps the one switch that overrides it with the guardrails it deserves: a CLI and a menu bar app, safe by default, built for humans and AI agents.

in the terminal

$ awake on 2h

  ● awake is on - your Mac will keep running with the lid closed
    auto-off at 6:45 PM (in 2h)
    turn off early: awake off

$ awake status --json
{ "data": { "enabled": true, "remaining_seconds": 7134, "battery": { "percent": 82, "on_ac": true } } }

auto-off by default

Every session gets a timer backed by launchd. A forgotten toggle restores normal sleep on its own, even after a crash or reboot.

scoped sudo, once

Setup installs a sudoers rule for exactly two pmset commands. Nothing else gets elevated, and uninstall removes it.

visible state

The menu bar shows a sun with a live countdown while active, and you get a notification when auto-off fires.

built for agents

Stable JSON envelopes, meaningful exit codes, an AGENTS.md contract. Your coding agent can run it before long jobs.

commands

awake onkeep the Mac awake for 1 hour (the safe default)
awake on 3hdurations: 30m, 2h, 1h30m, bare numbers are minutes
awake on --foreverno timer, stays on until you turn it off
awake offrestore normal sleep now
awake statusstate, timer, battery, one glance
awake setupone-time: authorize passwordless toggling

for ai agents

Output is JSON automatically when piped. Success is { "data": ... } on stdout, errors are { "error": { "code", "message", "hint" } } on stderr. Exit codes: 0 success, 1 error, 3 setup required. A Claude Code agent can run awake on 2h before a long build and awake off when it finishes early, and the timer covers the crash case. The full contract lives in AGENTS.md.

how it works

  1. 01awake on flips pmset disablesleep, the only switch that survives a closed lid. Setup authorizes exactly that command pair through /etc/sudoers.d/awake, nothing else.
  2. 02A launchd agent runs awake off just past the deadline, and again at login in case the deadline passed while the machine was off.
  3. 03The menu bar app and the CLI share one source of truth, so they can never disagree about whether your Mac is being kept awake.

Heads up: with awake on, a Mac in a closed bag keeps running and keeps making heat. That is exactly why the default is a one-hour timer, the status warns on battery power, and the menu bar never hides the state.