| name | silk |
| description | Accessibility-first macOS automation with DOM-level precision. Find and interact with UI elements by text, role, identifier, size, and hierarchy. Combines accessibility tree navigation with humanized mouse movements. Use when you need to click buttons, fill forms, control macOS applications, bypass bot detection, or automate UI workflows without coordinates. |
Silk โ macOS UI Automation
Native macOS automation tool using Accessibility API + Vision. Find and interact with UI elements by describing them โ no coordinates needed.
Binary: silk or ~/.local/bin/silk
Requirements: Accessibility permissions (System Settings โ Privacy & Security โ Accessibility)
Core Concepts
Silk finds elements via Accessibility API (like browser DevTools for native apps), then interacts using OS-level trusted input events that bypass bot detection.
Element references work like CSS selectors: Describe what you want, Silk finds it.
Auto-scroll: Off-screen elements automatically scroll into view before interaction.
Humanization: Optional Bezier curve mouse movement + Fitts's Law timing to mimic human behavior.
Common Patterns
Basic Interaction
silk click "Submit"
silk type "username" "user@example.com"
silk key cmd c
silk key cmd shift n
silk key enter
silk paste "Hello world"
Precision Targeting
When multiple elements match, use filters:
silk click "1" --min-width 150
silk click "Close" --max-width 50
silk click "Share" --sibling-index 2
silk click "OK" --parent-role Dialog
silk click --identifier "submit-btn"
silk click "Share" --parent-role Toolbar --sibling-index 2 --min-width 40
App Targeting
silk click "Submit" --app Chrome
silk app switch Chrome
silk click "Submit"
Humanized Automation (Bot Detection)
Use --humanize when interacting with sites that detect bots:
silk click "Login" --humanize --trail
silk type "password" "secret" --humanize
Humanization features:
- Bezier curve mouse paths (not straight lines)
- Fitts's Law timing (distance-based speed)
- OS-level trusted events (
kCGHIDEventTap)
- Visual trail overlay shows movement path
Scrolling
silk scroll down --pages 1
silk scroll up --pages 2
silk scroll to "Submit" --app Chrome
silk scroll down --at 500,300 --app Chrome
silk scroll down --from "Content" --app Chrome
Auto-scroll: silk click automatically scrolls off-screen elements. Disable with --no-scroll if speed-critical.
Screen Inspection
silk screenshot --info /tmp/screen.png
silk ocr
silk find --app Chrome --json | jq '.elements[] | {title, role, size}'
silk find --at-cursor
silk click "Submit" --highlight
Element References (Advanced)
Store element references to reuse later without repeating queries:
REF=$(silk find "Button 1" --app Chrome --json | jq -r '.elements[0].ref')
silk click "@$REF" --app Chrome --humanize
Reference types:
id:... โ By identifier (most stable)
ref:Button-3-WebArea โ Structural (role + position + parent)
pos:Button-200-400 โ Spatial (role + coordinates)
Self-Correcting Pattern
When automation fails, UI state likely changed. Check for blockers:
silk find --app Chrome --json > /tmp/ui-state.json
cat /tmp/ui-state.json | jq '.[] | select(.role == "AXWindow" and (.title | contains("says")))'
silk click "OK" --app Chrome
silk click "Submit" --app Chrome
Common blockers:
- Alert dialogs:
role=="AXWindow" with title containing "says" / "alert"
- Modal sheets:
subrole=="AXSheet"
- Loading overlays: Text containing "loading" / "please wait"
Recovery loop: Inspect โ Diagnose โ Handle โ Retry โ Verify
App & Window Management
silk app launch Chrome
silk app launch Safari --url https://google.com
silk app launch TextEdit --file ~/doc.txt --hidden
silk app quit Chrome
silk app quit Safari --force
silk app switch Chrome
silk app hide Chrome
silk app list --json
silk window list
silk window move Chrome 0 0
silk window resize Chrome 1200 800
silk window fullscreen Chrome
silk menu list --app Chrome
silk menu click "File" "New Tab" --app Chrome
silk dock list
silk dock click "Safari"
Clipboard & Dialogs
silk clipboard read
silk clipboard write "text"
silk clipboard clear
silk dialog list
silk dialog click "OK"
silk dialog input "filename.txt"
silk dialog wait
Critical Gotchas
Switch to target app first: Silk clicks at screen coordinates. If another window is in front, the click lands there. Always use silk app switch <app> before automation.
Keys are space-separated: Use silk key cmd c, NOT silk key "cmd+c".
Web scroll needs --at coordinates: When scrolling in browsers, point inside the web content area: silk scroll down --at 500,300.
Password fields report empty values: macOS security prevents reading password field contents. Use visual verification instead.
Auto-scroll adds latency: If element is known to be on-screen and speed is critical, use --no-scroll.
Command Reference
For complete command syntax and options, see COMMANDS.md.
Quick command list:
silk click <text> โ Find and click element
silk type <selector> <text> โ Type into field
silk key <keys>... โ Press keyboard shortcuts
silk paste <text> โ Paste via clipboard
silk drag <x1> <y1> <x2> <y2> โ Drag operation
silk find <text> โ Find elements (no action)
silk scroll <direction> โ Scroll viewport
silk screenshot [path] โ Capture screen
silk ocr [path] โ Extract text via OCR
silk app <subcommand> โ Manage apps
silk window <subcommand> โ Manage windows
silk menu <subcommand> โ Menu bar interaction
silk dock <subcommand> โ Dock interaction
silk clipboard <subcommand> โ Clipboard operations
silk dialog <subcommand> โ Dialog handling
Debugging Tips
Can't find element? Inspect app structure:
silk find --app Chrome --json | jq '.elements[] | {title, role, size, identifier}'
Element not clickable? Check if off-screen or blocked:
silk find "Submit" --app Chrome --highlight
Automation failing? Enable visual trail to see mouse path:
silk click "Submit" --humanize --trail --trail-duration 5
Permission denied? Grant Accessibility permissions and restart terminal.