.claude/skills/macos-applescript-tcc-hang/SKILL.md
Fix AppleScript hanging indefinitely when automating macOS apps (Messages, Mail, etc.) due to stale TCC (Transparency, Consent, and Control) Automation entries. Use when: (1) `osascript` hangs on `tell application "Messages"` operations like sending, counting chats, or accessing accounts, (2) Simple AppleScript like `tell app "Messages" to name` works but any operation touching accounts/chats/participants hangs forever, (3) AppleScript returns "AppleEvent timed out (-1712)" after ~2 minutes, (4) Automation that previously worked stops working after macOS update or system changes, (5) Rebooting doesn't fix the hang. The fix is `tccutil reset AppleEvents` followed by re-approving permission popups.
npx skillsauth add Dbochman/dotfiles macos-applescript-tcc-hangInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
AppleScript automation of macOS apps (especially Messages.app) hangs indefinitely or
times out with error -1712. The TCC (Transparency, Consent, and Control) database
entries for AppleEvents become stale or corrupted, causing the AppleScript scripting
bridge to block on operations that access app internals (accounts, chats, contacts)
while simple property queries (name) still work.
osascript -e 'tell application "Messages" to name' returns immediately (works)osascript -e 'tell application "Messages" to count of chats' hangs foreverosascript -e 'tell application "Messages" to send "hi" to buddy "+1..." of (1st account whose service type = iMessage)' hangs foreverexecution error: Messages got an error: AppleEvent timed out. (-1712)macOS stores AppleEvents (Automation) permissions in the TCC database at
~/Library/Application Support/com.apple.TCC/TCC.db. When entries become stale
(after macOS updates, app updates, or process identity changes), the scripting bridge
gets stuck trying to validate permissions rather than prompting for new consent.
The key insight is that the TCC subsystem doesn't cleanly fail — it hangs the AppleEvent dispatch, making the calling process block indefinitely.
tccutil reset AppleEvents
This clears ALL Automation permission entries. Every app that uses AppleScript to control other apps will need to re-authorize.
Run an AppleScript that triggers the permission prompt:
osascript -e 'tell application "Messages" to send "test" to buddy "+1XXXXXXXXXX" of (1st account whose service type = iMessage)'
Important: This must run from a context that has GUI access:
open /path/to/script.command (runs in GUI session)A system dialog will appear: "Terminal.app wants to control Messages.app" (or whatever app is calling osascript). Click OK/Allow.
Any background services (like OpenClaw gateway) that use osascript need to be
restarted so their child processes get fresh TCC authorization:
launchctl stop ai.openclaw.gateway
launchctl start ai.openclaw.gateway
The first send attempt from the service may trigger another permission popup for the service's app bundle identity.
After resetting and approving:
# Should return immediately with the message sent
osascript -e 'tell application "Messages" to send "test" to buddy "+1XXXXXXXXXX" of (1st account whose service type = iMessage)'
# Should return a number (not hang)
osascript -e 'tell application "Messages" to count of chats'
Before resetting TCC, confirm the issue is TCC-related:
# Test 1: Simple property (should work even with stale TCC)
osascript -e 'tell application "Messages" to name'
# Expected: "Messages" (instant)
# Test 2: Internal object access (hangs with stale TCC)
osascript -e 'tell application "Messages" to count of accounts'
# Expected if broken: hangs, then "AppleEvent timed out (-1712)"
# Test 3: Send attempt
osascript -e 'tell application "Messages" to send "test" to buddy "+1..." of (1st account whose service type = iMessage)'
# Expected if broken: hangs indefinitely
If Test 1 works but Test 2/3 hangs, the issue is stale TCC entries.
tccutil reset AppleEvents is a nuclear option — it resets permissions for ALL apps.
You can try resetting for a specific app first: tccutil reset AppleEvents com.apple.Terminal
but this doesn't always work for the scripting bridge.osascript call must originate from a process
that macOS associates with a GUI-capable app bundle. Using open -jg script.command
from a LaunchAgent runs the script in the Aqua session where permission dialogs can appear.op read TCC hang (which is Mach port / Security framework
based) — see skill 1password-cli-launchd-hang.chat id AppleScript path (for group chats) is affected the same way as the buddy
path (for DMs) — both hang when TCC is stale.tools
Use exact configured Reolink cameras through the local Home Hub for availability and power status, fresh stills, visual commentary, protected Dylan/Julia/household sharing, and reversible spotlight control. Supports trusted owner tasks and explicitly scoped proactive automations; not for Nest or Ring cameras, arbitrary recipients, recordings, account changes, or raw camera APIs.
data-ai
Privately manage Dylan and Julia's household plant inventory and care history by physical location, bed, and exact Flower Cam view. Use for confirmed plant onboarding from camera conversations, camera- or bed-filtered inventory, record corrections, individual or whole-bed care, and private filtered exports. Pair with reolink-camera when an owner asks about plants visible in Flower Cam images.
testing
Inspect and control the physically secured Reachy Mini at Crosstown through ClawBody. Use for requests to check Reachy, look around, express an emotion, play any official emotion or dance preset, speak proactively, mute or unmute its microphone, stop movement, or describe what its camera sees.
tools
Handle Reachy/iMessage handoffs, selective durable memory, forgetting, and diagnostics; automatic context comes from the gateway plugin.