browser-use/macos-harness
The simplest, thinnest harness that gives an LLM complete freedom to control a Mac.
macOS Harness – a bridge for AI agents to control Mac apps
What it does
macOS Harness is a small Python‑based command‑line tool that lets a language‑model‑driven coding agent interact with any macOS application without moving the real mouse cursor. The agent can:
- Query an app’s UI state as a numbered list of text elements and a screenshot (
get_app_state). - Perform actions such as click, type, press keys, scroll, drag, paste, select text, set values, or invoke secondary actions, all by referring to the numbered UI elements (
click,type_text,press_key, …). - Read the UI again to see what changed, enabling a read‑act‑read loop.
How it works
The CLI talks to a background helper process over a local socket. The helper uses macOS Accessibility APIs to read the accessibility tree of the target window and to issue accessibility actions (or, when needed, low‑level events) directly to the app’s process. Because the real mouse never moves, the user’s front‑most app stays visible. A custom on‑screen pointer shows where the agent “clicks”. The tool also waits for the app to settle before returning a new UI snapshot.
Typical workflow
- Install the package (Python 3.12,
uvrecommended). - Register the agent (
macos-harness install --agent claude). - Run a command, e.g.
macos-harness get_app_state --app "TextEdit". - Use the returned element numbers to drive further actions (
click,type_text, etc.). - Optionally configure a
policy.tomlto require user confirmation before the first use of each app.
Permissions
The tool needs macOS Accessibility and Screen‑Recording permissions; macos-harness doctor checks and reports any missing rights. An optional clipboard‑file is used briefly when the paste command runs.
Telemetry & licensing
Anonymous telemetry (command category, success, duration, version, OS/arch, detected agent) is on by default but can be disabled with macos-harness telemetry disable. The project is MIT‑licensed and macOS‑only.
Who it’s for
Developers building AI coding assistants (Claude, Codex, Pi, OpenCode, etc.) who want their agents to manipulate native macOS apps programmatically without taking control of the user’s desktop.
Related
- Project
- Project
- Project
- Project