A tiny native macOS menu-bar switch for keeping your Mac awake.
MacCoffeeBar is a small macOS menu-bar app for preventing idle sleep without keeping a Terminal window open. It:
- toggles idle-sleep prevention with a left-click;
- optionally keeps the display awake;
- can launch at login, but always starts turned off;
- uses native Apple frameworks without a
caffeinatesubprocess, telemetry, tight polling, or a continuously running background loop; - checks GitHub Releases at most once per day by default and lets you disable automatic checks.
Download MacCoffeeBar.zip, unzip it, and move MacCoffeeBar.app to /Applications. Launch MacCoffeeBar from there. The app runs only in the menu bar, so it does not have a Dock icon or an application window.
The current public build is ad-hoc signed instead of signed with an Apple Developer ID. If macOS blocks the first launch, Control-click MacCoffeeBar in Finder and choose Open, then confirm Open. You can also use Open Anyway under System Settings > Privacy & Security after a blocked launch. Bypass Gatekeeper only for a copy you built yourself or received from a source you trust.
The first release with update notifications must be installed manually. Older builds, including v1.0.0, do not contain the checker and cannot announce that release.
If you installed the earlier CoffeeBar build, first turn off its Launch at Login option, quit it, and remove /Applications/CoffeeBar.app. MacCoffeeBar uses a new bundle identifier, so its preferences and login item are separate and do not migrate automatically.
Choose an Active Duration from Until Turned Off, 15 Minutes, 30 Minutes, 1 Hour, 2 Hours, or 4 Hours. MacCoffeeBar remembers the choice, but every process launch still starts off, including launches at login. Left-click the coffee-cup icon to turn idle-sleep prevention on for the selected duration or off. The outlined, dim cup means off; the filled cup means on.
Right-click the icon to open its menu:
The menu follows the current macOS Light or Dark appearance and updates when the system appearance changes while MacCoffeeBar is running.
Status: N min leftappears while a timed session is on. The status updates when you open the menu; there is no live countdown or repeating polling timer.Active Durationlets you choose how long a new session runs. Changing the duration while MacCoffeeBar is on restarts the timer with the new duration. When a timed session expires, MacCoffeeBar silently releases its power assertions.Keep Display Awakecontrols whether idle-sleep prevention also prevents idle display sleep. With this option off, MacCoffeeBar prevents idle system sleep while allowing the display to sleep. The choice persists between launches, and changing it while MacCoffeeBar is on updates the live power assertions immediately.Launch at Loginreflects and controls the macOS login item. MacCoffeeBar requests this setting on its first launch. macOS may require approval under System Settings > General > Login Items.Update Available: vX.Y.Z…appears when a newer release is available and opens its validated GitHub release page. Download the new ZIP there, then follow the manual install steps above: unzip it and moveMacCoffeeBar.appto/Applications. MacCoffeeBar never downloads or installs an update itself.Check for Updates Nowruns a manual check.Check for Updates Automaticallycontrols the once-daily check and is enabled by default.Quit MacCoffeeBarreleases MacCoffeeBar's power assertions and exits the app.
When an update is available, a small badge appears on the menu-bar coffee cup.
MacCoffeeBar can prevent idle sleep only while it is on and running. It cannot override sleep caused by closing a Mac laptop's lid, choosing Sleep explicitly, shutting down or restarting, or macOS battery-critical power policy.
When automatic checks are enabled, MacCoffeeBar sends one unauthenticated request to the public GitHub Releases API at most once every 24 hours while the app is running. Failed attempts are also throttled. Manual checks are additional. The app sends no telemetry or user identifier, and it opens a validated github.com/resteqs/MacCoffeeBar release page only after you select the update menu item.
Install Xcode or Apple's Command Line Tools with Swift 6.2 or newer, then run the test suite from the repository root. The app's runtime minimum remains macOS 13.
Scripts/test.shThe wrapper enables Swift Testing and supplies the active Command Line Tools paths when SwiftPM needs them. No test-runner flags or other setup are required. Arguments are passed through to swift test, so commands such as Scripts/test.sh --filter Preferences work as expected.
Build and ad-hoc sign a release application bundle:
Scripts/build-app.sh releaseThe script writes dist/MacCoffeeBar.app. It also accepts debug; release is the default when no configuration is given.
For direct distribution, follow Apple's Developer ID certificate documentation and install a Developer ID Application certificate in your login Keychain.
Build the release bundle, then replace its ad-hoc signature with your Developer ID signature:
Scripts/build-app.sh release
SIGNING_IDENTITY='Developer ID Application: Your Name (TEAMID)'
codesign --force --options runtime --timestamp \
--sign "$SIGNING_IDENTITY" dist/MacCoffeeBar.app
codesign --verify --deep --strict --verbose=2 dist/MacCoffeeBar.appReplace Your Name (TEAMID) with the exact identity printed by:
security find-identity -v -p codesigningStore notarization credentials without putting the app-specific password in shell history. Omitting --password makes notarytool ask for it securely:
xcrun notarytool store-credentials "MacCoffeeBar-notary" \
--apple-id "your-apple-id@example.com" \
--team-id "YOURTEAMID"Create a submission ZIP and wait for Apple's result:
ditto -c -k --keepParent \
dist/MacCoffeeBar.app dist/MacCoffeeBar-notarization.zip
xcrun notarytool submit dist/MacCoffeeBar-notarization.zip \
--keychain-profile "MacCoffeeBar-notary" \
--waitAfter the response says Accepted, staple and validate the app, then create the ZIP intended for GitHub Releases:
xcrun stapler staple dist/MacCoffeeBar.app
xcrun stapler validate dist/MacCoffeeBar.app
codesign --verify --deep --strict --verbose=2 dist/MacCoffeeBar.app
spctl --assess --type execute --verbose=4 dist/MacCoffeeBar.app
ditto -c -k --keepParent dist/MacCoffeeBar.app dist/MacCoffeeBar.zip
shasum -a 256 dist/MacCoffeeBar.zipSee Apple's notarization overview and custom notarization workflow for the current requirements.
Turn off Launch at Login from MacCoffeeBar's right-click menu, then quit the app. Open System Settings > General > Login Items and remove or disable MacCoffeeBar if it is still listed. Move /Applications/MacCoffeeBar.app to the Trash.