For Gemini CLI
How do I keep my Mac awake while Gemini CLI works?
Short answer
We found no built-in sleep handling in Gemini CLI, in its docs or its settings, so your Mac can idle-sleep in the middle of a task. The free fix is to start it with caffeinate -i gemini. Night Crew adds a one-click hook that keeps the Mac awake only while Gemini CLI works, with lid mode and battery guards.
What Gemini CLI already does about sleep
We found no built-in sleep handling in Gemini CLI. On 5 November 2026 we read its docs, including the configuration reference and the hooks pages, and searched its GitHub issues for “caffeinate”, “keep awake” and “prevent sleep”. Nothing in either is about keeping the computer awake.
So when your Mac’s idle timer runs out, it sleeps, whether or not Gemini CLI is in the middle of a turn.
The free fix: caffeinate
macOS ships with caffeinate. Start Gemini CLI through it:
caffeinate -i gemini
-i stops idle sleep, and caffeinate holds it “as long as that process is running”
(man page). If your lid stays open and you’re plugged in, this is often all you
need.
Where that falls short
- It holds while Gemini waits for you. caffeinate follows the process, not the work. If you leave a finished session open, the Mac stays awake until you quit it.
- The lid. Closing the lid forces sleep, and Apple says apps can’t prevent it, only delay it (QA1340).
- Battery. caffeinate has no battery floor. It holds on 5% the same as on 100%.
What Night Crew adds
- A one-click hook. Night Crew adds a small hook to Gemini CLI’s user settings, so it sees each turn start and end, each tool call, and the end of the session. The hook exits within a second, because Gemini CLI waits for hooks before it carries on.
- Awake only while it works. When a turn ends, Night Crew waits 60 seconds, then lets the Mac sleep. A build Gemini leaves running keeps the Mac up for at most 2 hours.
- Lid mode. Close the lid and Gemini CLI keeps working. It’s on the charger only by default.
- Guards. A battery floor at 15% (30% in lid mode on battery), a heat guard that’s always on in lid mode, and a 24-hour cap.
How to set it up
- Download Night Crew and open it.
- Open Settings › Agents and click set up next to Gemini CLI. Night Crew backs up
~/.gemini/settings.jsonfirst, adds its hooks next to your existing settings, and keeps the three newest backups. - Start Gemini CLI as usual.
To remove it, use the same row: one click and a confirm. Using other agents too? Night Crew also works with Claude Code, Codex and Cursor. Other ways to keep a Mac awake are on /compare.
Questions
Does Gemini CLI keep my Mac awake on its own?
Not that we could find. Gemini CLI's docs, including its configuration and hooks pages, don't mention it, and a search of its GitHub issues for caffeinate, "keep awake" and "prevent sleep" on 5 Nov 2026 found nothing about it. If that changes, we'll update this page.
Will Night Crew's hook slow Gemini CLI down?
It's built not to. Gemini CLI waits for each hook to finish before it carries on, so Night Crew's hook only records the event and exits within a second. It prints nothing but the empty reply Gemini CLI expects.
Is caffeinate -i gemini enough?
Often, yes: if your lid stays open, it keeps the Mac awake until you quit Gemini CLI. It also holds while Gemini waits for you, it doesn't stop at a battery level, and it can't help once you close the lid.
Sources
- Gemini CLI docs: hooks (configured in settings.json)
- Gemini CLI docs: configuration reference
- gemini-cli GitHub issues searched for caffeinate, "keep awake", "prevent sleep"
- caffeinate man page (ss64)
- Apple QA1340: idle sleep vs forced sleep
Checked 5 November 2026.