An open-source macOS menu-bar utility that keeps your Mac awake for a chosen duration. Built for Apple Silicon and macOS 26 (Tahoe) or newer with a native Liquid Glass UI.
🏆 Ranked #10 Product of the Day on Product Hunt
- Timed sessions from 5 minutes to 8 hours, plus a keep-awake-forever mode
- Separate control over display sleep and system sleep
- Live menu-bar countdown and a customizable global shortcut
- Optional battery threshold that stops an active session
- Launch-at-login, Dock visibility, appearance, and menu-bar icon preferences
- EdDSA-verified automatic updates through Sparkle
Download the latest archive from GitHub Releases, extract it, and move Open Caffeine.app to /Applications.
Open Caffeine releases are EdDSA-signed for Sparkle update integrity, but the app is not Apple code-signed or notarized. On first launch, macOS may require System Settings → Privacy & Security → Open Anyway.
Prerequisites:
brew install xcodegen swiftlintGenerate and build:
xcodegen generate
xcodebuild -project OpenCaffeine.xcodeproj -scheme OpenCaffeine -configuration Release buildThe app bundle is in ~/Library/Developer/Xcode/DerivedData/OpenCaffeine-*/Build/Products/Release/Open Caffeine.app.
Auto-updates use Sparkle. SUFeedURL points at
appcast.xml in this repo (served via raw.githubusercontent.com), and updates
are EdDSA-signed with the private key in your login keychain (public key is in
Info.plist as SUPublicEDKey).
To cut a release:
- Bump
MARKETING_VERSION/CURRENT_PROJECT_VERSIONinproject.yml. - Run
Scripts/release.sh— builds Release, zips, EdDSA-signs, and regeneratesappcast.xml. - Create a GitHub release tagged
v<version>and uploaddist/Open-Caffeine-<version>.zip. - Commit & push
appcast.xml.
The Updates preferences tab ("Check Now" + automatic checks) drives the real Sparkle updater against that feed.
xcodebuild -project OpenCaffeine.xcodeproj -scheme OpenCaffeine -destination 'platform=macOS' testEvery logic file must keep 100% line coverage. The gate runs the suite with
coverage and fails if any non-excluded file under OpenCaffeine/ drops below 100%:
Scripts/coverage-gate.shIt is enforced on git push via a pre-push hook. Enable it once per clone:
git config core.hooksPath Scripts/hooksBypass a single push with git push --no-verify.
What's excluded and why. Only UI/AppKit/system shells are exempt — SwiftUI view
bodies, the @main entry, AppDelegate/MenuBarController wiring, NSAlert/NSWindow
presenters, and thin IOKit/SMAppService/KeyboardShortcuts/NSWorkspace adapters. Their
decision logic has been extracted into separately-tested types (GeneralSettingsActions,
BatteryThresholdFormatter, MenuBarIconModel, CustomDurationParser, AppLaunchLogic,
BatterySnapshotParser, the *Providing/*Controlling seams). The full, justified list
lives in Scripts/coverage_check.py — new source files are not exempt by default, so
adding one forces a conscious choice: test it, or extract its logic and list the shell.
- Start for 5 min → countdown begins at 5:00 next to icon.
- After 5 min, icon reverts and sleep works again.
- Forever → still awake after 30 min idle.
- Forever + "Keep the screen on" ON (default) → screen stays on past the display-sleep timer.
- "Keep the screen on" OFF → display may sleep, but the Mac stays awake.
- Toggling "Keep the screen on" during an active session takes effect immediately.
- Hotkey toggles caffeine on/off.
- Start-at-login toggle survives reboot.
- Show-in-dock toggle takes effect immediately.
- Battery threshold triggers stop (use
pmsetif hard to drain). -
pmset -g assertionsshowsPreventUserIdleDisplaySleepwhile active (or…SystemSleepwhen "Keep the screen on" is off). - About menu shows custom Open Caffeine panel.
- Screensaver launches from menu.
- Custom duration prompt accepts minutes input.
- Switching Appearance in Preferences changes the menubar icon immediately.
OpenCaffeine/
App/ # @main, AppDelegate (bootstrap)
MenuBar/ # NSStatusItem controller, menu builder, countdown formatter, custom-duration prompt
Services/ # SleepAssertion, CaffeineSession, HotKeyService, BatteryMonitor, LoginItemManager, ScreenSaverLauncher
Settings/ # SwiftUI Preferences scene + tabs
Models/ # CaffeineDuration, SessionState, MenuBarIconStyle
Resources/ # Assets.xcassets, About panel
OpenCaffeineTests/ # XCTest suites + Mocks/
docs/superpowers/ # Spec + plan that drove this build
project.yml # XcodeGen project definition (single source of truth — .xcodeproj is regenerated, not committed)
.swiftlint.yml # Lint config (file_length 500 hard cap)
See docs/superpowers/specs/2026-05-28-open-caffeine-design.md.
MIT © Open Caffeine contributors.