A tiny menu-bar app that stops your Mac from falling asleep. One click. Filled cup = awake. ☕
The story (or: why this exists at all)
I wanted the classic coffee-cup-in-the-menu-bar thing. Easy, right? Except my work laptop's MDM had other plans:
- Tried KeepingYouAwake → blocked.
- Tried the classic Caffeine app → blocked.
- Tried dropping a LaunchAgent → turns out the MDM had made
~/Library/LaunchAgentsroot-owned. Blocked.
At that point it was personal. Downloaded apps get a quarantine flag and have to clear notarization + an endpoint-management allowlist — but a binary you compile locally has no quarantine flag and isn't a pre-built app the MDM recognizes. So I got bored, opened a .swift file, and wrote my own in ~120 lines.
CaffeineOSS wasn't a real project. It's not on Homebrew, it wasn't on GitHub, the name didn't exist. I just built it because I was bored and the corporate firewall made me angry. Now it's here. ☕
What it actually does
Under the hood it's the same trick Apple's own /usr/bin/caffeinate uses — a single public IOKit call:
IOPMAssertionCreateWithName( kIOPMAssertionTypePreventUserIdleDisplaySleep as CFString, IOPMAssertionLevel(kIOPMAssertionLevelOn), "CaffeineOSS keeping the Mac awake" as CFString, &assertionID )
That's it. It asks the OS power manager to prevent user-idle display/system sleep while active, and releases the assertion when you toggle off. No kernel extensions, no private APIs, no special entitlements, no daemons phoning home.
- 🟤 Outline cup = sleep allowed (normal)
- ☕ Filled cup = staying awake
- ⏱ Timed modes — awake for 30 min / 1 h / 2 h / 5 h, then auto-off
- 🪶 Featherweight — one Swift file, zero dependencies, no Dock icon (menu-bar only)
Install (build it yourself — that's the whole point)
You need the Xcode Command Line Tools (xcode-select --install). Then:
git clone https://github.com/kuberwastaken/caffeineOSS.git
cd caffeineOSS
./build.sh
open CaffeineOSS.appbuild.sh compiles main.swift, wraps it in a proper .app bundle, and ad-hoc signs it locally — so there's no quarantine flag for an MDM/Gatekeeper to choke on.
Tip
Because you compiled it yourself, there's no com.apple.quarantine attribute and nothing for notarization gates to reject. This is exactly why it runs where the prebuilt apps didn't.
Start at login (survives reboots)
The clean way is a LaunchAgent — but if your MDM has locked down ~/Library/LaunchAgents (mine had), use the per-user Login Items list instead, which doesn't need that directory:
osascript -e 'tell application "System Events" to make login item at end with properties {path:"'$PWD'/CaffeineOSS.app", hidden:true, name:"CaffeineOSS"}'
Verify it took:
osascript -e 'tell application "System Events" to get name of every login item'You can also do this by hand in System Settings → General → Login Items → +.
Uninstall
# stop it osascript -e 'quit app "CaffeineOSS"' # remove from login items osascript -e 'tell application "System Events" to delete login item "CaffeineOSS"' # delete the build rm -rf CaffeineOSS.app
No-install fallback
If even a locally-built app gets blocked, macOS ships the original. Zero install, zero app:
caffeinate -d # keep display awake until Ctrl-C caffeinate -t 3600 # awake for 1 hour caffeinate make # awake until `make` finishes
CaffeineOSS is really just a friendly coffee cup glued on top of that idea.
Project layout
caffeineOSS/
├── main.swift # the entire app (~120 lines)
├── build.sh # compile → .app bundle → ad-hoc sign
├── assets/
│ └── banner.svg # the cup up top
└── README.md
License
MIT — see LICENSE. Do whatever you want with it. ☕
Built because I was bored and the corporate firewall made me angry.

























