ai newsDi., 1. Dez.

Mac-Tipps, damit Claude Code oder Codex beim Weggehen weiterläuft

Wer lange Agent-Tasks startet und den Rechner verlässt, kennt das Problem: Der Mac schläft ein oder ein Bestätigungsdialog wartet unbeachtet. Mit Tools wie caffeinate, tmux und ntfy sowie einigen Systemeinstellungen lässt sich das verhindern.

dev.toSonntag 22:21 · 29.11.DE3 Min. Lesezeit
Bild: dev.to

You start a long agent task, grab lunch, and come back to a sleeping Mac or a prompt that has been asking "Allow this command?" for 40 minutes. Neither one is the agent's fault.

These are the small Mac settings and tools I'd set up before walking away from a running Claude Code or Codex session. Most are free, and a few are already on your Mac.

macOS ships a caffeinate command that holds off sleep for as long as the command it wraps is running. Start the agent through it and the Mac stays awake exactly until the agent exits, with nothing to remember to turn off.

caffeinate -i claude Enter fullscreen mode Exit fullscreen mode 2. Use Amphetamine when you want a switch instead Amphetamine is a free keep-awake app on the Mac App Store with no ads or in-app purchases. It can keep the Mac awake for a set time, until a specific app quits, or while the lid is closed, and its Triggers can start a session automatically when a given app is running.

In System Settings > Battery > Options, there's a setting to prevent automatic sleeping on power adapter when the display is off. If you leave the laptop plugged in with the screen dimmed, this is the difference between "still working" and "paused since 12:05".

Control-Command-Q locks the Mac and leaves every process running. Closing a MacBook lid without an external display puts it to sleep, and the agent sleeps with it unless something like Amphetamine is holding it awake.

tmux is a terminal multiplexer: you can detach from a session, the programs keep running in the background, and you reattach later from a different terminal. An accidental Command-Q on the terminal app no longer takes the agent down with it.

brew install tmux tmux new -s agent Enter fullscreen mode Exit fullscreen mode 6. Reach that tmux session from your phone with Tailscale Tailscale puts your devices on one private network, and the Personal plan is free with unlimited user devices. Turn on Remote Login on the Mac, SSH in from your phone over the tailnet, run tmux attach -t agent, and you can answer one question without going back to the desk.

Most stalls are permission prompts for things you'd always say yes to, like running the test suite. Claude Code's permission rules let you allow specific commands ahead of time with /permissions, and "Yes, and don't ask again" saves a Bash rule for that repository. Keep the allowlist narrow: tests, linters and builds, not rm.

Claude Code hooks run shell commands at points in its lifecycle, and the Notification event fires when Claude is waiting for input or permission. The docs give a macOS example using osascript that pops a native notification. If nothing shows up, Script Editor needs notification permission in System Settings > Notifications.

ntfy is free, open source push notifications over plain HTTP: subscribe to a topic in the phone app and curl to it from anywhere. Swap the osascript line in the hook for this and the alert reaches you away from the desk:

curl -d "Claude Code needs you" ntfy.sh/pick-a-long-random-topic Enter fullscreen mode Exit fullscreen mode Without an account the topic name works like a password, so make it hard to guess.

git switch -c agent/lunch-task before you start means whatever the agent does while you're gone is one git diff main away from review, and one git switch main away from gone. If you want to keep coding in parallel, git worktree add gives the agent a separate folder on that branch.

A long unattended task that hits a usage limit 20 minutes in just sits there until you get back. TokenBar is a macOS 14+ menu bar app that shows usage and reset times for Claude, Codex, Cursor, Gemini and Copilot, so I'd glance at it before choosing which agent gets the long job. It's $5/month for Basic or $15 lifetime for Pro, doesn't add any quota, and is built on Peter Steinberger's MIT-licensed CodexBar, with credit to Pixel Agents.

What's the longest you've left an agent running unattended, and what did you set up first?

Originaltitel: Leaving Claude Code or Codex Running While You Step Away? 11 Mac Tips for 2026 (caffeinate, tmux, ntfy and More)Quelle: dev.to (dev.to). Original öffnen