A tiny macOS menu bar app that keeps your Mac working when you want it to, and always puts your sleep settings back when you don't.
Native Swift + AppKit. One source file. No dependencies.
macOS has two separate ideas of "stay awake":
caffeinate— a process-scoped assertion. Dies with the process, harmless.pmset -a disablesleep 1— a persistent, system-wide switch written to disk. It survives app quits and reboots.
Tools that offer "closed-lid mode" flip the second one. If they crash, or you force quit them, that switch stays set and your Mac silently never sleeps again — screen on all night, and toggling the app "off" does nothing, because the app was never what was holding it.
Awake exists because that happened. It uses the switch only inside a live session, and clears it on every exit path plus on every launch.
| Mode | What it does | Needs root |
|---|---|---|
| Screen off, kaam chalu | System stays awake, display sleeps normally (caffeinate -i) |
No |
| Screen on rakho | System and display both stay awake (caffeinate -di) |
No |
| Lid band, kaam chalu | Work continues with the lid shut (caffeinate -i + sleep switch) |
Yes |
Each has durations: 15 min / 30 min / 1 hour / 2 hours / Indefinite. The menu bar shows a live countdown (● 14:59), or ● ∞.
The sleep switch is cleared on all of these:
- Turn Off or Quit Awake from the menu
applicationWillTerminate(logout, restart)SIGTERM/SIGINT/SIGHUPviaDispatchSourceSignalatexit— covers uncaught exceptions- On launch — detects and heals a switch left stale by a previous crash
Plus: if caffeinate dies, the session ends itself. In lid-shut mode on battery below 20%, the session ends itself — a closed lid can't vent heat, and a flat battery mid-session risks an ungraceful shutdown.
Known gap: SIGKILL (kill -9) can't be trapped by any process. If Awake is SIGKILLed mid-session, the switch stays set until the next launch, where step 5 heals it.
./build.sh
./install.shinstall.sh copies the app to /Applications, installs a login agent, and adds a sudoers rule scoped to exactly two commands:
<you> ALL=(root) NOPASSWD: /usr/bin/pmset -a disablesleep 0, /usr/bin/pmset -a disablesleep 1
It cannot change any other setting or run any other binary. Skip install.sh and the two non-root modes still work — only lid-shut mode is unavailable.
./uninstall.shIf you ever suspect something left the switch set:
pmset -g | grep -i SleepDisabled0 is healthy. 1 means stuck — sudo pmset -a disablesleep 0 fixes it.
- The app is ad-hoc signed. On a Mac other than the one that built it, Gatekeeper will block first launch: right-click → Open, then allow. Proper distribution needs a paid Apple Developer ID and notarization.
LSUIElementis set, so there's no Dock icon while running — the menu bar item is the whole UI. You can still dragAwake.appto the Dock as a launcher.- Lid shut without an external display means the lid, your main heat sink, can't dump heat. Fine for light background work; keep the lid open for long builds.
MIT