Skip to content

Repository files navigation

Cafinat

Tiny menu bar caffeinator for macOS. ~90 lines of Swift. One click to keep your Mac awake. No settings, no telemetry, no fluff.

Cafinat icon

Latest release Total downloads License: MIT macOS 13+ Swift


What it does

Cafinat sits in your menu bar as a coffee cup. Click it once — your Mac will not sleep, dim, or run the screensaver. Click again — back to normal. Right-click for status / quit.

Under the hood it's a thin wrapper around macOS's built-in caffeinate -di command, with a self-watchdog flag (-w $$): if Cafinat ever crashes or is force-quit, the underlying caffeinate dies with it. No orphan processes.

Why another caffeinate app?

Tool Status Code size Notes
Caffeine (original) abandoned 2014 unknown doesn't work on modern macOS
Amphetamine active, App Store large feature-rich, requires App Store account, ad-style upsells
KeepingYouAwake active, open source ~5,000 LoC Obj-C great app, larger codebase
Lungo $4.99 closed paid
Cafinat (this) active, open source ~90 LoC Swift minimum viable caffeinator

This is the smallest auditable caffeinate menu bar app I'm aware of. If you want a feature dashboard with timers, schedules, and triggers — use Amphetamine. If you want something you can read end-to-end in 5 minutes, build yourself, and trust — Cafinat.

Install

.dmg from Releases (recommended)

  1. Download Cafinat-*.dmg from the latest release.
  2. Open the .dmg, drag Cafinat.app to Applications.
  3. First launch: the app isn't notarized (notarization needs the $99/yr Apple Developer fee). macOS Gatekeeper will block it. Right-click Cafinat.app → Open → confirm. After that, double-click works normally.
  4. Cafinat appears as a coffee cup ☕ in your menu bar.

Build from source

git clone https://github.com/alexxety/cafinat.git
cd cafinat
bash build.sh
open build/Cafinat.app

Requirements: macOS 13+, Xcode Command Line Tools (xcode-select --install).

Usage

Action Result
Left-click the menu bar icon Toggle caffeinate on/off
Right-click Show status (Active/Inactive) and Quit
Filled cup ☕️ Active — Mac stays awake
Outlined cup Inactive — normal sleep behavior

That's the whole UI. There are no preferences, no accounts, no hotkeys, no notifications.

How it works

Cafinat uses NSStatusItem to put a cup icon in the menu bar. When you click it, it spawns /usr/bin/caffeinate -di -w $cafinat_pid:

  • -d — prevents the display from sleeping
  • -i — prevents the system (idle) from sleeping
  • -w $$ — caffeinate exits when the watched PID (Cafinat itself) exits

When you click again or quit Cafinat, the caffeinate process is terminated. If Cafinat crashes, -w ensures caffeinate cleans itself up.

The status icon switches between two SF Symbols:

  • cup.and.saucer (outlined) — inactive
  • cup.and.saucer.fill (filled) — active

That's it. Read the source: Cafinat/AppDelegate.swift — under 100 lines.

Auto-launch on login

There's no built-in setting. Use macOS native:

System Settings → General → Login Items & Extensions → + → add Cafinat.app.

FAQ

Is Cafinat sandboxed?

No. It needs to spawn /usr/bin/caffeinate as a child process, which a sandboxed app cannot do reliably. There's no network access, no file I/O outside the bundle, no entitlements requested.

Does it use any private API?

No. NSStatusItem, NSMenu, Process, NSImage(systemSymbolName:) — all public AppKit / Foundation.

Why isn't it in the App Store?

App Store requires a $99/year Apple Developer account. This is a free side project. PRs welcome to ship on the App Store if anyone wants to maintain that.

Why is the bundle ID com.cafinat.app and not com.alexxety.cafinat?

Historical — the project started as a placeholder bundle ID. Changing it after release would break upgrade paths for early users, so we kept it.

Will Cafinat drain my battery?

caffeinate -di keeps the display on, which is the main battery cost. Only use it when you actually need the Mac awake (presentations, downloads, long compiles). When inactive, Cafinat itself idles at near-zero CPU.

Contributing

PRs welcome. See CONTRIBUTING.md. Common things that would help:

  • Localized tooltips (right-click menu)
  • Optional auto-stop after N minutes
  • Homebrew Cask (brew install --cask cafinat)
  • Apple Developer ID notarization sponsorship

License

MIT — use, fork, ship inside other projects, no strings.


Keywords for search engines: macos caffeinate menu bar, prevent mac from sleeping, keep mac awake free, caffeine alternative mac, amphetamine alternative, minimal menu bar app, swift menu bar caffeinator, macos display sleep prevention, mac stay awake utility, caffeinate gui, prevent screensaver mac, presentation mode mac, no sleep mac app.

About

Tiny menu bar caffeinator for macOS — ~90 lines of Swift. One click to keep your Mac awake. No settings, no telemetry, no fluff.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages