Handle macOS TCC Accessibility permission grants and failures when driving other apps' UI via the AXUIElement API
domain: developer.apple.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Check trust status at runtime with AXIsProcessTrusted() before attempting any AXUIElement calls, since untrusted calls fail or return errors without prompting on their own
Use AXIsProcessTrustedWithOptions with the trusted-check prompt option to trigger the system consent dialog on first run, directing the user to System Settings > Privacy & Security > Accessibility
Know there is no supported programmatic way to add an app to the Accessibility list — only the user can grant it manually, so setup instructions should point users to that pane explicitly
Re-grant Accessibility access after every rebuild of an unsigned or ad-hoc-signed development binary, since macOS ties the grant to the binary's code signature and path
For CLI tools invoked from Terminal, grant Terminal (or iTerm) itself Accessibility access, since the permission attaches to the actual parent process making the AX calls
Known gotchas
A documented macOS issue causes AXIsProcessTrusted's per-process cache to go stale across OS/TCC database updates, so a running process can wrongly believe its trust status is unchanged until restarted
Routine rebuilds during development can silently revoke a previously granted Accessibility permission, since TCC keys the grant to the binary's code signature
Accessibility and Full Disk Access are separate TCC permissions with separate prompts — AXUIElement automation specifically needs Accessibility, and granting Full Disk Access instead won't fix AX call failures
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?