Minimal macOS menu bar app to prevent sleep with two configurable modes.
- macOS 11.0+
- Swift 5.5+
- Terminal
bash build.shOutput: build/caffeine-mode.app
cp -r build/caffeine-mode.app ~/Applications/Then open the app and enable Settings > Launch at Login.
- Build and open the app
- Coffee cup icon (
cup.and.saucer.fill) appears in the menu bar - Click the icon to open the menu
- Click a mode to activate it — click again to stop
The icon is tinted blue or orange while a mode is active. Hover over a mode to see a tooltip with the underlying command.
| Mode | Command | Effect | Color |
|---|---|---|---|
| Long Runs | caffeinate -di |
Prevents idle sleep and display sleep. Disk may still sleep. | Blue |
| ML Training | caffeinate -dim |
Blocks all sleep: system, display, and disk. | Orange |
Switching modes stops the current one and starts the new one immediately.
| Setting | Default | Description |
|---|---|---|
| Launch at Login | Off | Auto-start on login via SMAppService |
| Hide from Dock | On | App appears only in the menu bar |
macOS blocks app after rebuild (code signature mismatch):
codesign --remove-signature build/caffeine-mode.app"Permission denied":
chmod +x build/caffeine-mode.app/Contents/MacOS/caffeine-mode"Compilation failed":
xcode-select --installcaffeinate still running after stop:
killall caffeinate