macOS TCC permissions for unattended AI agents: stop losing nights to hidden prompts
If you run AI agents unattended on a Mac (Claude Code in iTerm, a launchd job driving osascript , Hammerspoon clicking buttons), you've probably woken up to find nothing happened overnight. The cause is usually one dialog sitting on an unwatched screen: "Terminal" would like to control "System Events" . That's macOS TCC (Transparency, Consent and Control). Here's how to set it up once so it stops…
If you run AI agents unattended on a Mac, you may have experienced issues waking up to find tasks did not complete overnight. This is typically due to Terminal Control (TCC) Transparency, Consent and Control permissions dialogs appearing on an unmonitored screen. To prevent this from occurring repeatedly, a proper setup process should be established.
The crucial concept is that TCC permissions belong to the host application, not the script. If Claude runs inside iTerm, iTerm needs the grant. If a launchd job runs /bin/bash script.sh, the grant goes to the binary named in the prompt. Therefore, the first rule is to select one terminal app as the agent host and grant everything associated with it. Having agents in multiple terminal apps leads to multiple sets of permissions that can become misaligned.
Next, identify each agent task and its specific TCC requirements. These may include permission for apps to interact with other applications (Accessibility), control another app via osascript, take screenshots or record audio, access specific files or folders, and grant global hotkeys. Automations typically require permission once per target application.
After setting up these permissions, run a read-only health check before bed to ensure the system is functioning correctly. This can be done using osascript commands to verify various functionalities like getting the name of the first process, the startup disk, and capturing screenshots.
Following macOS updates or app re-signing can occasionally invalidate these permissions. To address this, simply remove the app from the list using the minus button, add it back, and relaunch it. A comprehensive first-time setup checklist for this process can be found on GitHub. For additional guidance, the macOS TCC Agent Fleet Runbook priced at $12 provides a complete permission map, step-by-step recovery procedures for common issues, and a fleet log to track permissions across multiple machines.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.