Keep your Mac awake during long builds and compiles
A long Xcode archive, a cargo build --release, a Gradle or npm install, or a local CI run is the classic moment macOS decides the machine is idle. The screen dims, the system sleeps, and the build stalls or dies. Keepresso keeps the Mac awake for the job, then lets it rest when the work is done.
Pick the approach that matches the job
1. Timed session (simplest)
If you know the build usually finishes within a window:
- Click the Keepresso cup in the menu bar.
- Pick a duration (1 hour, 4 hours, custom, or Until a Time).
- Start keep-awake and start the build.
When the timer ends, Keepresso stops holding the system awake. Details: timed sessions.
2. Process trigger (hands off)
Stay awake only while the build tool is actually running:
- Open Preferences → Triggers.
- Turn trigger gating on.
- Add a Process running condition and match the command, for example
xcodebuild,swift,cargo,rustc,gradle,java,node,npm,pnpm,make,ninja, orcmake. - Combine with any if you use more than one tool.
When the process exits, Keepresso drops the session (after any grace period you set) and the Mac can sleep again. See smart triggers.
3. CPU-load trigger (tool-agnostic)
If the tool name changes but the machine is clearly working:
- Add a CPU above a threshold condition (50% or 75% is a good starting point).
- Keep the smoothing: a brief spike will not open a session; sustained load will.
This is ideal for mixed toolchains or IDE builds that spawn different child processes under different names.
4. Media Render / AI Agent presets
Built-in presets cover common long jobs:
- Media Render holds while
ffmpegruns. - AI Agent holds while a coding agent (
claude,codex,gemini, and friends) is actually working, not just open, so an overnight agent run on a laptop finishes and the Mac still sleeps once the work is done.
Apply a preset from the condition menu; it replaces the current rule set and turns triggers on.
Want to know the moment the job is done? An event hook under Preferences, Automation can run a Shortcut, POST a webhook, or run a shell command when the session ends or the agent goes idle, a push to your phone included. And if the job starts before you wake up, a scheduled wake from the same tab gets the Mac up in time.
Optional: screen off, lid closed
Builds do not need a lit panel.
- Turn off prevent display sleep if you only care about the system staying up. Guide: Keep the Mac awake with the screen off.
- On a MacBook, enable closed-display mode so the machine keeps compiling in a bag or on a shelf, with the internal panel put to sleep when the lid closes. Guide: Lid closed.
Battery safety
On a laptop, pair keep-awake with battery auto-pause so a forgotten session does not drain the pack. Set a floor (for example 20%) under Preferences; Keepresso pauses when charge drops below it. More: smart triggers.
Scripts and CI machines
For headless build machines or scripted pipelines:
# Hold the Mac awake exactly as long as the build runs (app not required)
your-build-command & keepresso -w $!
# Or drive the running app
keepresso start --for 120
keepresso stop
For unattended pipelines, an automation lease is safer than a start-and-stop pair: it is a bounded grant the script keeps renewing, so a crashed job cannot pin the Mac awake, the lease just expires.
ID=$(uuidgen)
keepresso lease acquire --id "$ID" --tool ci --task "release build" --ttl 600
# ... heartbeat on a loop while the build runs ...
keepresso lease release --id "$ID"
If the job is driven by an AI agent, you do not even write this yourself: a bundled skill and an MCP server teach the agent the whole protocol. See let AI agents keep your Mac awake.
Install and PATH notes: keepresso CLI. On a Mac mini used only for builds, also run the Headless Setup checklist so login and sleep policies match an always-on machine.
Related
Get Keepresso
Free and open source, for macOS 14 and newer. Install it and keep your Mac awake on your terms.
More in Using Keepresso
