A tiny macOS menu bar app that stops your Mac falling asleep. One coffee mug, two states, no background work.
| Icon | State | Behaviour |
|---|---|---|
| Outline mug | Inactive | Normal system behaviour |
| Filled mug | Active | Display sleep, screen saver and idle lock are blocked |
caffeinate -d in a terminal does the same job, but it ties the state to a window you have
to keep around and gives you nothing to glance at. StayAwake is that command with a visible
switch: one look at the menu bar tells you whether your Mac is going to stay up.
- Left-click the mug to toggle.
- Right-click for a menu: toggle, Launch at Login, Quit.
- The state is remembered across restarts.
Launch at Login can also be set from the command line:
/Applications/StayAwake.app/Contents/MacOS/StayAwake --login-item on # or off / statusIf macOS reports requires approval, enable it under
System Settings → General → Login Items.
git clone https://github.com/marionuevo/StayAwake.git
cd StayAwake
./build.sh
cp -R build/StayAwake.app /Applications/
codesign --force --sign - /Applications/StayAwake.app
open /Applications/StayAwake.appRe-signing after the copy matters — a moved bundle's ad-hoc signature can otherwise go stale and macOS will refuse to launch it.
./build.sh # produces build/StayAwake.app (universal arm64 + x86_64, ad-hoc signed)Requires only the Xcode Command Line Tools (xcode-select --install) — there is no Xcode
project and no package manager. The entire app is one Swift file, Sources/main.swift,
compiled straight into a hand-assembled .app bundle by build.sh.
Minimum macOS is 13. The mug glyph (mug / mug.fill) is a macOS 15 SF Symbol, so on 13
and 14 the icon falls back to cup.and.saucer.
Active mode holds a single kIOPMAssertionTypePreventUserIdleDisplaySleep power
assertion — the same mechanism behind caffeinate -d. The kernel tracks the assertion, so
the app runs no timers and polls nothing: it sits at 0% CPU. Inactive mode releases it.
The whole thing is one Swift file and a universal binary well under half a megabyte.
The assertion blocks idle sleep only. Manual locking (⌃⌘Q) and closing the lid still work in either state, and the assertion is released if the app quits or crashes, so there is no way to leave your Mac permanently awake by accident.
Verify what is holding your Mac awake at any time with:
pmset -g assertions | grep StayAwakeMIT © 2026 Mario Nuevo
