A tiny menu-bar app that prevents your Mac from going to idle sleep while selected apps are running. Add Ghostty, Xcode, your dev server, Zoom — anything where a 5-minute sleep timeout would interrupt real work. When the watched app quits, the assertion releases automatically and your Mac sleeps as configured.
Unlike caffeinate or always-on solutions, Nightcap is event-driven: it
holds a kernel-level power assertion only while watched apps are alive, and
releases the moment they exit. Zero polling, zero battery overhead when idle.
- Watches
NSWorkspacelaunch/terminate notifications for your selected bundle IDs - Holds
kIOPMAssertionTypePreventUserIdleSystemSleepvia IOKit when any watched app is running - Reconciles state on system wake (handles forced kills, sleep/wake cycles)
- Runs fully sandboxed — no privileged helpers, no shell scripts, no LaunchAgents
- Persists your watched-app list to a local JSON file in the app container
- macOS 14.0 (Sonoma) or later
- Xcode 16+ to build from source
Mac App Store: Nightcap Awake is free to download.
Homebrew:
brew install --cask Abdo-codes/tap/nightcapMaintainer release notes live in docs/HOMEBREW.md.
Build from source:
git clone https://github.com/Abdo-codes/Nightcap.git
cd Nightcap
brew install xcodegen
xcodegen
open Nightcap.xcodeprojPress ⌘R in Xcode to run. The app appears as a cup-and-saucer icon in your menu bar — no Dock icon.
- Click the cup icon in your menu bar
- Choose Add Running App for an app that's already open, or click Add App… to pick one from disk (e.g. Ghostty)
- While that app is running, the icon switches to the filled-cup state and your Mac won't sleep
- Choose Pause Watching to keep an app in your list without holding sleep, then Resume Watching when you want it active again
- Optionally enable Launch at Login to start Nightcap on boot
Use a watched app's submenu to pause, resume, or remove it from the list.
- Swift 5 + SwiftUI — modern declarative UI
- MenuBarExtra (macOS 13+) — native menu-bar entry point
- TCA (The Composable Architecture) — reducer-based state management
- IOKit
IOPMAssertion— kernel-level sleep prevention SMAppService— sandbox-safe launch-at-login (macOS 13+)- xcodegen — project file generation from
project.yml
xcodebuild test -project Nightcap.xcodeproj -scheme Nightcap \
-destination 'platform=macOS,arch=arm64'14 unit tests cover launch/terminate/wake reconciliation, multi-instance termination, duplicate-add no-op, launch-at-login error rollback, pause/resume watching, running-app suggestions, legacy list migration, and quit releases the assertion.
Nightcap collects zero data. No analytics, no telemetry, no network calls. The watched-app list is stored locally in your app sandbox container and never leaves your machine. See PRIVACY.md for the full policy.
PRs welcome — see CONTRIBUTING.md. The codebase is small and well-tested; good entry points are listed under "Good first issues" on the issue tracker.
MIT — see LICENSE. You're free to fork, modify, and redistribute, including shipping your own derivative on the Mac App Store, as long as the copyright notice stays intact.
