For agents · Aider

Keep your Mac awake
while Aider works.

Aider pair-programs from your terminal, so a sleeping Mac stops it mid-edit. Midnight Oil keeps the Mac awake for exactly as long as Aider runs, including scripted runs with the lid closed.

The short answer

Start Aider through Midnight Oil: midnightoil run -- aider. For scripts, wrap a one-shot run: midnightoil run --lid-closed -- aider --message "…" --yes-always.

Aider at a glance

Runs whereIn your terminal, on your Mac
Interactiveaider
Unattendedaider --message "…" applies one request and exits
Instructions fileA conventions file loaded with --read CONVENTIONS.md, or read: in .aider.conf.yml
Needs your Mac awake?Yes. With a local model, the model server does too.

What happens when your Mac sleeps mid-run

Aider waits on the model and edits files as replies stream in. If the Mac sleeps mid-reply, the stream is cut and the edit stops where it was; you come back to a half-finished change and a failed request.

Aider doesn't keep the Mac awake itself, and long multi-file requests are exactly the ones that outlast the idle timer.

Running Aider unattended

Aider mostly edits rather than running long commands itself, so the instruction-file trick matters less here than wrapping the whole run. aider --message applies one request and exits; --yes-always accepts its prompts. Loop over files in a script, wrap the script with midnightoil run, and the Mac stays awake until the last one is done.

Running Aider against a local model? The model server has to stay awake as well, which this covers too: see Ollama.

Keep the Mac awake for the whole session

midnightoil run -- aider

Or for one unattended run

midnightoil run --lid-closed -- aider --message "add type hints to utils.py" --yes-always utils.py

Lid closed, battery safe

Add --lid-closed and Aider keeps working with the laptop shut. It needs a one-time approval in Midnight Oil's Settings › Closed Lid, and normal sleep comes back the moment the session ends, even if the app quits or crashes.

On battery, sessions can end when you unplug or drop below a level you pick, and an alarm sounds if the lid closes during a closed-lid session. Add --allow-display-sleep to let the screen go dark while the Mac keeps working. The full setup is in how to run AI agents overnight.

Questions

Does Aider keep running when the Mac sleeps?

No. The model request drops and the edit stops partway. Start Aider with midnightoil run -- aider so the Mac stays awake for the session.

How do I run Aider unattended overnight?

Script it with aider --message "…" --yes-always, and wrap the script: midnightoil run --lid-closed -- ./refactor.sh. The Mac sleeps normally once the script ends.

Can I tell Aider to keep the Mac awake?

Aider is a pair programmer more than a command runner, so it's more reliable to start it through midnightoil run than to ask it mid-chat.

Let Aider work the night shift.

Free. No account, no subscription.

macOS 14 or later · Apple Silicon and Intel · brew install --cask coreyhaines31/tap/midnightoil