agentleFS
calebnewtonusccalebnewtonusc/Chewbacca/skills/mac-debug/SKILL.md

mac-debug

Skill8 starsChanged 3 months agoMITView on GitHub

Diagnose a Mac automation that is failing, especially one failing silently. Use when a click does nothing, typing does not appear, the accessibility tree is empty, an AppleScript hangs or errors, coordinates land in the wrong place, or something that worked before stopped working.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If that returns kAXErrorAttributeUnsupported (-25208) on a non-Chromium app, the app genuinely has no tree and you are at layer 5.

    line 49
  2. Very specific:

    When chewie click "Save" cannot find something, the element is probably not called what it looks like it is called.

    line 98

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debugging Mac automation

Most of these fail with no error, which is what makes them expensive. Diagnose before you retry, and never respond to a failure by escalating to a screenshot. A failing layer-3 read almost always means one specific fixable thing.

Triage

chewie doctor                    # grants, host app, tools
chewie doctor --secure-input     # is the keyboard being blocked

By symptom

Typing does nothing, no error

Secure Input. A password field has focus somewhere, and macOS discards synthetic keystrokes with no error. It is a process-global reference-counted flag, so one stuck app starves the whole system.

ioreg -l -w 0 -d 1 -k IOConsoleUsers | grep -o 'kCGSSessionSecureInputPID"=[0-9]*'

Nonzero is the pid holding it. Fix: open -a Finder, retry. If an app is stuck, focus and unfocus it, or quit it.

Clicks do nothing from inside an app

App Sandbox silently blocks CGEvent.post. No error. No fix inside the sandbox; this is why every serious macOS automation tool ships outside the App Store.

Accessibility tree is empty or all elements unnamed

Chromium builds it lazily. Chrome, Edge, VS Code, Slack, Discord, Notion, Figma, Spotify.

chewie see --app Slack --force-ax

Sets AXManualAccessibility, waits ~400ms, re-reads. The wait matters: an immediate re-read still looks empty.

If that returns kAXErrorAttributeUnsupported (-25208) on a non-Chromium app, the app genuinely has no tree and you are at layer 5.

Clicks land at double the offset

Retina. Screenshots are 2x device pixels; CGEvent takes screen points. Halve the coordinate, or stop using coordinates and use refs.

Clicks land on the wrong monitor

Multi-display origins go negative. Use CGGetActiveDisplayList geometry, do not assume 0,0.

Clicking a ref hits the wrong element

Stale ref. It was scoped to a snapshot from before the UI changed. Re-snapshot after any sheet, navigation, resize, or scroll.

AppleScript errors

CodeMeaningFix
-1743Not authorizedtccutil reset AppleEvents, retry in the foreground
-600App not runningopen -a "App", then poll until System Events sees it
-1712Timeout (~2min)with timeout of 300 seconds. Check for a blocking modal
-1728Object does not existNot permissions. Read the app's dictionary
-1750errOSASystemErrorUsually TCC, reported uselessly

defaults write had no effect

Apps cache preferences in memory and rewrite on quit. Write with the app closed, or restart it. killall cfprefsd if a read looks stale.

chat.db rows have NULL text

Bodies moved to attributedBody on Ventura and later. Decode the typed stream, or use mac_messages_mcp.

"database is locked"

Open read-only (file:...?mode=ro) or copy to /tmp first.

do JavaScript fails in Safari

Develop > Allow JavaScript from Apple Events is off by default. Enable the Develop menu in Safari > Settings > Advanced first.

The web task dies at a login page

A fresh Playwright browser has no profile. Attach to the user's running Chrome: open -a "Google Chrome" --args --remote-debugging-port=9222.

It worked yesterday

Almost always: the TCC prompt was dismissed once and never returns, or the host app changed (different terminal, an update that re-signed the binary). chewie doctor.

Inspecting an element by hand

When chewie click "Save" cannot find something, the element is probably not called what it looks like it is called. Apple's Accessibility Inspector (bundled with Xcode) shows the real role, title, and available actions.

The stop rule

Three failures on the same action: stop and report what you tried and what you saw. Do not loop, and do not switch layers to route around a diagnosis you have not made.

Full list with detectors: docs/WORKAROUNDS.md and data/failure-modes.json.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.