macOS
agent-desktop reads macOS apps through the Accessibility (AX) API. The loop, refs, JSON envelope, sessions, and traces match every platform, so this page covers only what differs on macOS. The macOS behavior here is checked against the macOS adapter, its tests, and the macOS skill (agent-desktop skills get macos); it was not run for these docs.
Requirements
- macOS 13 or later, Intel or Apple Silicon.
- Accessibility permission for the app that launches agent-desktop, such as Terminal, iTerm2, VS Code, or your agent's host app. If System Settings lists the
agent-desktopbinary separately, grant it too. - Screen Recording permission, only for
screenshotand forsession start --screenshots.
Grant and check permissions
The grant belongs to the app that launched agent-desktop, not to the shell. A different terminal or an IDE needs its own grant.
- Run
agent-desktop permissions. It does not prompt. - If a permission is
denied, runagent-desktop permissions --guide. It opens System Settings at the missing permission with a panel that shows which app to add, and returns at once withdata.guideset tostarted,already_running, ornot_needed. - If the guide cannot run, open System Settings > Privacy & Security > Accessibility, add the launching app, and turn it on.
- Run
agent-desktop permissionsagain and confirmgranted. The app does not need a restart.
automation stays unknown until macOS would need to prompt. permissions --request is the only path that prompts, and it covers Automation; --guide covers Accessibility and Screen Recording. Under tmux, the guide offers the app that started the tmux server, which can differ from the terminal you attach from. Under SSH there is no launching app, so the guide offers the agent-desktop binary.
What works headless
Ref actions are headless by default. Under --headed, click, right-click, type, clear, and scroll use physical paths first, except a click on an item in the application's native menu bar hierarchy or in any open menu: agent-desktop activates the owning app and calls AXPress without moving the cursor. A headless click on these menu items calls AXPress without activating the app. Headless mode returns POLICY_DENIED before it touches the app when an action would show a menu or open a dialog: right-click, select through a menu, click or expand on a pop-up button, menu button or combo box, and click, toggle, check or uncheck on a label that ends in … or .... Add --headed when that is intended. Owner-judgment rule: a label that ends in an ellipsis ("…" U+2026 or "..."), after trailing whitespace is trimmed, is the convention shared by GTK, Qt and macOS applications for a control that opens a dialog. It is a predictor, not a proof: no accessibility property says that a control opens a window. Under --headed, right-click, double-click, and triple-click support windowless native menu items by focusing the app and keeping pointer verification. hover and drag still require the ref's source window and fail with ACTION_NOT_SUPPORTED when it has none. Other ref-target pointer actions focus the exact owning window and verify the hit target before delivery. A window-backed popup uses its live owning window even when its snapshot is application-owned. expand, collapse, set-value, select, toggle, check, uncheck, focus, and scroll-to stay semantic. See Headed mode.
A text field that shows a file's name, such as a Finder name cell, does not rename the file when its value is written: the field shows the new text while the file keeps its name. set-value, clear and headless type on such a field return ACTION_NOT_SUPPORTED with not_delivered. Rename through the app's own rename command or the file system.
| Group | Works headless | Needs --headed | Fails closed or not supported |
|---|---|---|---|
| Observation | snapshot, find, get, is, list-surfaces, list-displays | ||
| Capture | screenshot, with Screen Recording permission | ||
| Ref actions | click, type, clear, scroll, expand, collapse, set-value, select on a list, table, outline or editable combo box, toggle, check, uncheck, scroll-to, focus | right-click, select through a menu, click or expand on a pop-up button, menu button or combo box, click, toggle, check or uncheck on a label that ends in … or ... | Headless: POLICY_DENIED |
| Multi-click and pointer | double-click when the element offers AXOpen | double-click, triple-click, hover, drag, mouse-move, mouse-click, mouse-wheel | Headless: POLICY_DENIED |
| Keyboard | Scoped press (--app or --window-id), headless, return and escape run as accessibility actions on the focused element and every other key needs a focused element in the app (ACTION_FAILED, details.check: process_focus, not_delivered otherwise); a headless shortcut with a modifier never runs a menu item, so click the item instead | Unscoped press | Quit shortcuts such as cmd+q: POLICY_DENIED without --force |
| Held input | key-down, key-up, mouse-down, mouse-up | ||
| App and window | launch, close-app, list-apps, list-windows, resize-window, move-window, minimize, maximize, restore | focus-window | |
| Clipboard | clipboard-get | clipboard-set (read back: delivered_verified), clipboard-clear | |
| Wait | All modes. wait --notification sees only an already-open Notification Center | ||
| Notifications | list-notifications while Notification Center is open | Listing while it is closed, and every dismiss and action | Headless listing with the center closed: POLICY_DENIED |
| Shell surfaces | open-system-surface for dock and menu-bar-extras, returned at once because they are always on screen | start-menu, taskbar, system-tray, system-tray-overflow, action-center: INVALID_ARGS | |
| System | status, permissions, version, batch, skills, session, cursor-overlay, trace |
Judge delivery by observation. AX return codes do not prove an effect: an app can return success from an action that does nothing, so re-read with get, is, or a snapshot.
App naming
--app takes the display name list-apps prints, such as "System Settings" or "TextEdit", or a bundle ID such as com.apple.TextEdit; both rank equally. An executable name, such as ControlCenter for Control Center, counts only when no running app has it as its display name or bundle ID. When two running apps match equally, the command returns AMBIGUOUS_TARGET; target one by its bundle ID. launch accepts the same display name or bundle ID. Window ids such as w-4521 stay valid for the life of the window; find them with list-windows.
Surfaces
supported_surfaces lists window, focused, menu, menubar, sheet, popover, alert, dock, and menu-bar-extras. Use --surface menubar for an app's File, Edit, and View menus. Use --surface menu-bar-extras for status items: without --app it reads system items such as Wi-Fi, Battery, and Clock; with --app it reads that app's own item. Use --surface dock for the Dock. These shell surfaces are available headless through open-system-surface. A background app with no window, such as a menu-bar app or Control Center, can be read through its process. This applies to window, menubar, and menu-bar-extras, not focused; a regular app that has not shown a window returns WINDOW_NOT_FOUND. While a menu, sheet, alert, or popover is open, refs from the window tree behind it are the wrong target. See Surfaces.
Keys and notifications
- The primary modifier is
cmd:press cmd+c --app "TextEdit". Punctuation keys work as the symbol or by name (comma,period,slash). cmd+q,cmd+shift+q,cmd+alt+esc,ctrl+cmd+q, andcmd+shift+deletereturnPOLICY_DENIEDunless you pass--force. To quit an app, useclose-app.press cmd+s --app "TextEdit"sends the chord only when that app is frontmost. For a background app it returnsACTION_FAILED(check: process_focus) and sends nothing.- A Save panel's name field takes a file name, never a path, and macOS shows a
/typed there as:. Choose the folder with the panel's Where pop-up, which opens a menu and so needs--headed. Confirm the file on disk afterwards. - When agent-desktop opens Notification Center, it closes it afterward and restores the previous focus. Pass
--expected-appand--expected-titleon a single dismiss or action, because the stack shifts. Usewait --notification --app "App"for banners that vanish before you can list them.
Chromium and Electron
agent-desktop turns on web accessibility in a Chromium renderer when it needs it. For a dense running app, take a skeleton and drill with --root. For the web contents of an Electron app you can launch fresh, launch "App" --cdp opens a DevTools endpoint for agent-browser. See Chromium and Electron apps.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
PERM_DENIED, or permissions shows denied | The launching app has no Accessibility permission, or no Screen Recording permission for screenshot | Follow the grant steps above |
| Few nodes or no refs | Custom-rendered UI, or a Chromium renderer still settling | Check permissions, drop -i, raise --timeout-ms, and run list-surfaces in case the content is in a sheet |
complete: false or a slow snapshot | A deep tree ran out of budget | Use find, or a skeleton and --root. See Skeleton and drill-down |
APP_UNRESPONSIVE after right-click with retry: unsafe | AXShowMenu entered modal menu tracking after the menu opened | Do not retry. Run snapshot --surface menu; for a combo box or menu button, use select |
select cannot confirm the choice | It needs a closed-to-open menu change, and a menu was already open | Dismiss the open menu, then run select again |
WINDOW_NOT_FOUND | A window-owned surface has no open window | launch "App" with --activate, then list-windows --app "App" |
| A shortcut does nothing | ctrl used where macOS uses cmd, or the keys went to another app | Use cmd+..., or scope with --app |
More cases are in agent-desktop skills get macos.