macos-harness

browser-useMIT活跃维护

让大模型直接操控 Mac 的最薄封装层,通过辅助功能接口和 CDP 把桌面操作交给 Agent,省去复杂中间层。

The simplest, thinnest harness that gives an LLM complete freedom to control a Mac.

v0.2.1发布于 2026-10-15 03:51 UTC1,012star +2 / 7 天64fork同步于 2026-11-10 11:51 UTC

怎么上手

由 README 提炼,执行前请确认
uv 安装 Python 3.12 环境下的包后运行:macos-harness install --agent NAME(NAME 为 claude、codex、pi 或 opencode),再运行 macos-harness doctor 检查权限
硬件要求按 README 说明

README 未说明硬件要求;仅支持 macOS,需授予辅助功能和屏幕录制权限,另有两个可选权限。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

让任意编码 Agent 用十一条命令在后台操控 Mac 应用,不抢焦点也不动你的鼠标

让大模型直接操控 Mac 的最薄封装层,通过辅助功能接口和 CDP 把桌面操作交给 Agent,省去复杂中间层。

核心能力

  • 用 get_app_state 把窗口读成带编号的文本行
  • 点击、输入、按键等操作按元素编号或截图像素定位
  • 通过辅助功能动作和进程内事件执行,真实指针不移动
  • 再次读取时只输出与上次相比的变化
  • 自带策略文件可要求首次使用某应用前先询问

容易踩的坑

需在 macOS 系统设置中手动授予辅助功能和屏幕录制权限,否则每次调用都会失败;默认开启匿名遥测,可用 macos-harness telemetry disable 关闭;降级到旧版本前要先运行 macos-harness uninstall --agent all。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.2.1
  1. v0.2.1最新正式版2026-10-15 · 2026-10-15 03:51 UTC

    Your agent's own interrupt is now the stop button.

    Upgrade: after upgrading, run macos-harness install --agent <yours> again. Old Codex hooks do not stop typing on Esc.

    Changed

    • Ctrl+C, or Esc in Claude Code, Codex or Pi, stops the running action (a long type_text, a drag, a hold) before its next key or click.
    • Removed: Escape twice, the menu bar item, stop and resume. An old stop file is no longer read, so a stop left over from earlier can no longer block every call.
    • Every refusal the agent sees now says what happened and what to do next.
    • ask_before_first_use asks in a small panel of its own.
    • Fixed: two agents starting at the same moment could fail their first read with KeyError: 'AXUIElementCreateApplication'.

    Measured on a real Mac

    Interrupt sent 0.6 s into a 2,000-character type_text:

    hostinterrupttyped
    PiEsc680
    CodexEsc649
    Claude CodeEsc748, 777
    codex execCtrl+C562
    pi -pCtrl+C945 of 10,000

    Live tests 23 of 23. Two agents at once right after a helper restart: 10 of 10 clean. Pointer moved 0 times, front app changed 0 times.

    Known limits

    • No global kill switch: a headless or scheduled run is stopped by ending its process.
    • nohup macos-harness ... & stops when its shell exits.
  2. v0.2.0macOS Harness v0.2.02026-10-14 · 2026-10-14 18:57 UTC
    查看更新说明

    A rebuild of the harness around one helper process. Agents drive Mac apps in the background: the real pointer does not move and no app comes to the front, so the person keeps working beside the agent.

    • Read: an app's window as a numbered text tree from the Accessibility API, then only what changed, with a screenshot.
    • Act: click, type_text, press_key, set_value, scroll, drag, select_text and menu actions, sent to the target app's process.
    • The person stays in charge: the agent is refused in an app the person is using; Escape twice or the menu-bar Stop halts everything until the person resumes.
    • No approval prompt by default. The agent's own host app and the system password and Touch ID sheets are always refused. ask_before_first_use = true in the policy file turns prompts back on.
    • Any agent: macos-harness install --agent claude|codex|pi|opencode|all writes the skill and turn hooks.

    Upgrade from 0.1.x: the old Python-on-stdin commands are gone; run macos-harness install --agent all again. Rollback: run macos-harness uninstall --agent all first, then install 0.1.2.

    Details, proof and risks: https://github.com/browser-use/macos-harness/pull/13

  3. v0.1.2macOS Harness v0.1.22026-08-17 · 2026-08-17 16:48 UTC
    查看更新说明

    Fix the animated project banner on PyPI by using the same absolute static-asset pattern as Browser Harness.

  4. v0.1.1macOS Harness v0.1.12026-08-17 · 2026-08-17 16:45 UTC
    查看更新说明

    Housekeeping release for the public launch.

    • Fix the PyPI project description and animated README hero
    • Shrink the source archive from 5.6 MB to 190 KB
    • Publish through the Linux trusted-publisher workflow
  5. v0.1.0macOS Harness v0.1.02026-08-17 · 2026-08-17 16:08 UTC
    查看更新说明

    The first public release of macOS Harness.

    • Six raw primitives for native and Electron apps: see, key, type, click, AX, and Apple Events
    • Browser Harness and the local filesystem in the same Python process
    • Background-only PID-targeted input and an animated virtual pointer that never moves the physical cursor
    • Automatic, focus-safe approval of Chrome remote debugging through system-wide Accessibility
    • A drop-in skill for Codex and Claude Code
    • Privacy-safe, opt-out anonymous telemetry

    Experimental. macOS only.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    macOS Harness ⌘

    Give any coding agent the apps on your Mac. One shell command per step. It works in the background: your pointer does not move and your front app stays in front.

    ● agent: needs something only an app's UI can do
    │
    ● macos-harness get_app_state --app "TextEdit"       the window as numbered text
    │
    ● macos-harness click --app "TextEdit" --element_index 12
    │
    ● macos-harness get_app_state --app "TextEdit"       only what changed
    │
    ✓ task complete                                      you kept working the whole time
    

    Your agent now has a Mac.

    Give it to your agent

    Paste this into Claude Code, Codex, Pi or OpenCode:

    Install or upgrade macOS Harness from https://github.com/browser-use/macos-harness with uv using Python 3.12. Then run `macos-harness install --agent NAME`, where NAME is the agent CLI you are (claude, codex, pi or opencode), and `macos-harness doctor`. Explain any missing macOS permission and ask before requesting it. Finally read one app that is already running, without bringing it to the front: `macos-harness get_app_state --app Finder`.
    

    That is it. The agent installs the package, gets the skill, checks permissions and reads its first app. Manual setup is available too. To go back to an older release, run macos-harness uninstall --agent all first.

    Eleven tools. Any app.

    macos-harness get_app_state --app "TextEdit"
    macos-harness click --app "TextEdit" --element_index 12
    macos-harness type_text --app "TextEdit" --text "hello world"
    macos-harness press_key --app "TextEdit" --key "super+s"
    macos-harness set_value --app "TextEdit" --element_index 7 --value "report.txt"
    macos-harness scroll --app "TextEdit" --element_index 3 --direction down --pages 1
    macos-harness get_app_state --app "TextEdit"
    

    Read, act, read again. get_app_state prints one line per thing on screen, each with a number, and the path of a screenshot. Every other tool takes that number, or a pixel of that screenshot. The rest of the eleven: list_apps, drag, paste, select_text and perform_secondary_action.

    There are no Spotify tools, Slack tools or Final Cut tools. The model gets the same eleven commands for every app. The skill is one page, and it is all an agent needs to read.

    How it works

       agent's shell                      helper (starts on the first call)
            │                                         │
      macos-harness click ...  ── local socket ──▶  numbers, last state, sessions
            │                                         │
       text on stdout          ◀──────────────  accessibility tree + window screenshot
                                                      │
                                        accessibility actions first, else events
                                        sent to the app's own process
    
    • Reads a window as text, and on the next read prints only what changed
    • Acts through accessibility actions first, then through events sent to the app's own process, so the real pointer never moves and your front app stays in front. Three exceptions, all on purpose: the action Raise, which the model asks for by name; System Settings, opened when a permission is missing; and a menu-bar menu an app fills only while it is open, which is opened for at most a quarter of a second
    • Draws a pointer of its own, so you can see where the agent acts
    • Waits by itself until the app has settled before it reads again
    • Asks nothing by default: the agent drives any app except its own host and the system's password sheets. To be asked before an agent's first use of each app, put ask_before_first_use = true in policy.toml in the state folder; strict = true forbids terminal apps too
    • Notices when you touch an app the agent is using
    • Stops when its agent is interrupted: Esc or Ctrl+C in the agent's own app ends the running action at its next key or click, and so does the agent's app exiting while the command still runs. There is no stop button of its own: an agent nobody can interrupt (a headless or scheduled run) is stopped by ending its process
    • Limits worth knowing: pages on the blocked_urls list of a policy file are noticed when the page is read and before the action after one that may have changed it, not while a page is loading; apps built on Electron or a plain web view give no URL to check; one call clicks at most 10 times and types at most 20,000 characters

    Permissions and privacy

    macos-harness doctor reports the macOS permissions: Accessibility and Screen Recording, which every call needs, and two optional ones, for the app that starts the harness.

    While paste runs, what was on your clipboard is kept in a file only you can read (in the state folder) for about four seconds, so that it can be put back, also after a crash.

    Anonymous telemetry is enabled by default. It records only the CLI command category, success, duration, package version, OS/architecture, and detected agent client. It never records prompts, app names, screenshots, UI text, scripts, paths, or window titles.

    macos-harness telemetry disable
    

    Experimental. macOS only. MIT licensed.