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-desktop binary separately, grant it too.
  • Screen Recording permission, only for screenshot and for session 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.

  1. Run agent-desktop permissions. It does not prompt.
  2. If a permission is denied, run agent-desktop permissions --guide. It opens System Settings at the missing permission with a panel that shows which app to add, and returns at once with data.guide set to started, already_running, or not_needed.
  3. If the guide cannot run, open System Settings > Privacy & Security > Accessibility, add the launching app, and turn it on.
  4. Run agent-desktop permissions again and confirm granted. The app does not need a restart.
{
  "version": "2.7",
  "ok": true,
  "command": "permissions",
  "data": {
    "accessibility": { "state": "granted" },
    "automation": { "state": "unknown" },
    "screen_recording": { "state": "granted" }
  }
}

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.

GroupWorks headlessNeeds --headedFails closed or not supported
Observationsnapshot, find, get, is, list-surfaces, list-displays
Capturescreenshot, with Screen Recording permission
Ref actionsclick, type, clear, scroll, expand, collapse, set-value, select on a list, table, outline or editable combo box, toggle, check, uncheck, scroll-to, focusright-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 pointerdouble-click when the element offers AXOpendouble-click, triple-click, hover, drag, mouse-move, mouse-click, mouse-wheelHeadless: POLICY_DENIED
KeyboardScoped 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 insteadUnscoped pressQuit shortcuts such as cmd+q: POLICY_DENIED without --force
Held inputkey-down, key-up, mouse-down, mouse-up
App and windowlaunch, close-app, list-apps, list-windows, resize-window, move-window, minimize, maximize, restorefocus-window
Clipboardclipboard-getclipboard-set (read back: delivered_verified), clipboard-clear
WaitAll modes. wait --notification sees only an already-open Notification Center
Notificationslist-notifications while Notification Center is openListing while it is closed, and every dismiss and actionHeadless listing with the center closed: POLICY_DENIED
Shell surfacesopen-system-surface for dock and menu-bar-extras, returned at once because they are always on screenstart-menu, taskbar, system-tray, system-tray-overflow, action-center: INVALID_ARGS
Systemstatus, 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, and cmd+shift+delete return POLICY_DENIED unless you pass --force. To quit an app, use close-app.
  • press cmd+s --app "TextEdit" sends the chord only when that app is frontmost. For a background app it returns ACTION_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-app and --expected-title on a single dismiss or action, because the stack shifts. Use wait --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

SymptomCauseFix
PERM_DENIED, or permissions shows deniedThe launching app has no Accessibility permission, or no Screen Recording permission for screenshotFollow the grant steps above
Few nodes or no refsCustom-rendered UI, or a Chromium renderer still settlingCheck permissions, drop -i, raise --timeout-ms, and run list-surfaces in case the content is in a sheet
complete: false or a slow snapshotA deep tree ran out of budgetUse find, or a skeleton and --root. See Skeleton and drill-down
APP_UNRESPONSIVE after right-click with retry: unsafeAXShowMenu entered modal menu tracking after the menu openedDo not retry. Run snapshot --surface menu; for a combo box or menu button, use select
select cannot confirm the choiceIt needs a closed-to-open menu change, and a menu was already openDismiss the open menu, then run select again
WINDOW_NOT_FOUNDA window-owned surface has no open windowlaunch "App" with --activate, then list-windows --app "App"
A shortcut does nothingctrl used where macOS uses cmd, or the keys went to another appUse cmd+..., or scope with --app

More cases are in agent-desktop skills get macos.