← 返回 Skills 市场
yidahis

Mac Use 1.0.0

作者 yidahis · GitHub ↗ · v1.0.0 · MIT-0
darwin ⚠ suspicious
253
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install mac-use-1-0-0
功能描述
Control macOS GUI apps visually — take screenshots, click, scroll, type. Use when the user asks to interact with any Mac desktop application's graphical inte...
使用说明 (SKILL.md)

Mac Use

Control any macOS GUI application through a screenshot → pick element → click → verify loop.

Setup

Platform: macOS only (requires Apple Vision framework for OCR)

System binaries (pre-installed on macOS):

  • python3 — via Homebrew (brew install python)
  • screencapture — built-in macOS utility

Python packages — install from the skill directory:

pip3 install --break-system-packages -r {baseDir}/requirements.txt

How It Works

The screenshot command captures a window, uses Apple Vision OCR to detect all text elements, draws numbered annotations on the image, and returns both:

  1. Annotated image at /tmp/mac_use.png — numbered green boxes around each detected text
  2. Element list in JSON — [{num: 1, text: "Submit", at: [500, 200]}, {num: 2, text: "Cancel", at: [600, 200]}, ...] where at is the center point [x, y] on the 1000x1000 canvas (origin at top-left)

You receive both by calling Bash (gets JSON with element list) and then Read on /tmp/mac_use.png (gets the visual). Always do both so you can cross-reference the numbers with what you see.

Quick Reference

# List all visible windows
python3 {baseDir}/scripts/mac_use.py list

# Screenshot + annotate (returns image + numbered element list)
python3 {baseDir}/scripts/mac_use.py screenshot \x3Capp> [--id N]

# Click element by number (primary click method)
python3 {baseDir}/scripts/mac_use.py clicknum \x3CN>

# Click at canvas coordinates (fallback for unlabeled icons)
python3 {baseDir}/scripts/mac_use.py click --app \x3Capp> [--id N] \x3Cx> \x3Cy>

# Scroll inside a window
python3 {baseDir}/scripts/mac_use.py scroll --app \x3Capp> [--id N] \x3Cdirection> \x3Camount>

# Type text (uses clipboard paste — supports all languages)
python3 {baseDir}/scripts/mac_use.py type [--app \x3Capp>] "text here"

# Press key or combo
python3 {baseDir}/scripts/mac_use.py key [--app \x3Capp>] \x3Ccombo>

Workflow

  1. Open the target app with open -a "App Name" (optionally with a URL or file path)
  2. Wait for it to load: sleep 2
  3. Screenshot the app:
    python3 {baseDir}/scripts/mac_use.py screenshot \x3Capp> [--id N]
    
    This returns JSON with file (image path) and elements (numbered text list).
  4. Read the annotated image at /tmp/mac_use.png to see the numbered elements visually
  5. Decide which element to interact with:
    • Prefer clicknum N — pick the number of a detected text element
    • Fallback click --app \x3Capp> x y — only for unlabeled icons (arrows, close buttons, cart icons) that have no text and therefore no number
  6. Act using clicknum, type, key, or scroll
  7. Screenshot again to verify the result
  8. Repeat from step 3

Commands

list

Show all visible app windows.

python3 {baseDir}/scripts/mac_use.py list

Returns JSON array: [{"app":"Google Chrome","title":"Wikipedia","id":4527,"x":120,"y":80,"w":1200,"h":800}, ...]

screenshot

Capture a window, detect text elements via OCR, annotate with numbered markers, and return the element list. The target window is automatically raised to the top before capture, so overlapping windows are handled.

python3 {baseDir}/scripts/mac_use.py screenshot chrome
python3 {baseDir}/scripts/mac_use.py screenshot chrome --id 4527
  • \x3Capp>: fuzzy, case-insensitive match (e.g. "chrome" matches "Google Chrome")
  • --id N: target a specific window ID (required when multiple windows of the same app exist)
  • Returns JSON with:
    • file: path to annotated screenshot (/tmp/mac_use.png)
    • id, app, title, scale: window metadata
    • elements: array of {num, text, at} — the numbered clickable text elements, where at is [x, y] center coordinates on the 1000x1000 canvas (origin at top-left)
  • If multiple windows match, returns a list of windows instead — pick one and retry with --id
  • The image is 1000x1000 pixels with green bounding boxes and blue number badges
  • Element map is saved to /tmp/mac_use_elements.json for clicknum

clicknum

Click on a numbered element from the last screenshot. This is the primary click method.

python3 {baseDir}/scripts/mac_use.py clicknum 5
python3 {baseDir}/scripts/mac_use.py clicknum 12
  • N: the element number from the last screenshot output
  • Reads the saved element map, activates the window, and clicks at the element's center
  • Returns JSON with clicked_num, text, canvas coords, and absolute screen coords

click

Click at a position using canvas coordinates. Fallback only — use for unlabeled icons.

python3 {baseDir}/scripts/mac_use.py click --app chrome 500 300
python3 {baseDir}/scripts/mac_use.py click --app chrome --id 4527 500 300
  • Coordinates are canvas positions (0-1000) from the screenshot image
  • x=0 is left, x=1000 is right; y=0 is top, y=1000 is bottom
  • Use this only when Vision OCR didn't detect the element (icon-only buttons, images, etc.)

scroll

Scroll inside an app window.

python3 {baseDir}/scripts/mac_use.py scroll --app chrome down 5
python3 {baseDir}/scripts/mac_use.py scroll --app notes up 10
  • Directions: up, down, left, right
  • Amount: number of scroll clicks (3-5 for moderate, 10+ for fast scrolling)
  • Mouse is moved to the center of the window before scrolling

type

Type text into the currently focused input field.

python3 {baseDir}/scripts/mac_use.py type --app chrome "hello world"
python3 {baseDir}/scripts/mac_use.py type --app chrome "你好世界"
  • --app: activates the app first to ensure keystrokes go to the right window
  • Uses clipboard paste (Cmd+V) for reliable Unicode/CJK support
  • Always click on the target input field first before typing

key

Press a single key or key combination.

python3 {baseDir}/scripts/mac_use.py key --app chrome return
python3 {baseDir}/scripts/mac_use.py key --app chrome cmd+a
python3 {baseDir}/scripts/mac_use.py key --app chrome cmd+shift+s
  • --app: activates the app first
  • Common keys: return, tab, escape, space, delete, backspace, up, down, left, right
  • Modifiers: cmd, ctrl, alt/opt, shift

Important Rules

  • Always screenshot before your first interaction with an app
  • Always screenshot after an action to verify the result
  • Always Read the screenshot image after running the screenshot command — you need both the element list AND the visual
  • Prefer clicknum over click — only use direct coordinates for unlabeled icons
  • Click before typing — ensure the correct input field has focus first
  • Multiple windows: if you get multiple_windows error, use list to see all windows, then pass --id
  • Popup windows (like WeChat mini-program panels) are separate windows with their own IDs — use list to find them and --id to target them
  • Wait after opening apps: use sleep 2-3 after open -a before taking a screenshot
  • Activate the app before screenshot/click: prepend osascript -e 'tell application "AppName" to activate' && sleep 1 when the target app may be behind other windows
  • Do not type passwords or secrets via this tool

Coordinate System (for fallback click only)

Screenshots are rendered onto a 1000x1000 canvas:

  • Origin (0, 0) is at the top-left corner
  • x increases left to right (0 = left edge, 1000 = right edge)
  • y increases top to bottom (0 = top edge, 1000 = bottom edge)
  • The app window is scaled to fit (aspect ratio preserved), centered, with dark gray padding

Example: Order food on Meituan in WeChat

# 1. Open WeChat
open -a "WeChat"
sleep 3

# 2. Screenshot WeChat — find the mini program window
python3 {baseDir}/scripts/mac_use.py list
# → find the mini program window ID

# 3. Screenshot the mini program (annotated + element list)
python3 {baseDir}/scripts/mac_use.py screenshot 微信 --id 41266
# → returns: {"file": "/tmp/mac_use.png", "elements": [{num: 1, text: "搜索", at: [500, 200]}, ...]}
# → Read /tmp/mac_use.png to see annotated image

# 4. Click "搜索" (element #1)
python3 {baseDir}/scripts/mac_use.py clicknum 1

# 5. Type search query
python3 {baseDir}/scripts/mac_use.py type --app 微信 "炸鸡"

# 6. Press Enter
python3 {baseDir}/scripts/mac_use.py key --app 微信 return
sleep 2

# 7. Screenshot to see results
python3 {baseDir}/scripts/mac_use.py screenshot 微信 --id 41266
# → Read /tmp/mac_use.png, pick a restaurant by number

# 8. Click on a restaurant (e.g. element #5)
python3 {baseDir}/scripts/mac_use.py clicknum 5
安全使用建议
This skill appears coherent and implements on-device macOS GUI automation. Before installing: (1) Inspect the script if you want extra assurance (it runs locally and uses /tmp for screenshots); (2) only grant Screen Recording and Accessibility to a host process you trust (prefer a Terminal session for testing rather than a long-lived background gateway process — granting these permissions to a daemon gives that process full visual/input access); (3) remember screenshots capture whatever is visible, so avoid running it while sensitive data (passwords, 2FA codes, private documents) is on-screen; (4) pip will install native macOS bindings (pyobjc) and pyautogui — review those package versions if you require strict dependency provenance. If you need automated or background use, plan how you manage host-process permissions carefully because those permissions are powerful.
功能分析
Type: OpenClaw Skill Name: mac-use-1-0-0 Version: 1.0.0 The skill provides powerful macOS GUI automation capabilities using Apple Vision OCR and Quartz APIs, which are aligned with its stated purpose. However, it is classified as suspicious due to multiple AppleScript injection vulnerabilities in `scripts/mac_use.py`. Specifically, functions like `activate_app`, `keystroke_via_osascript`, and `raise_window` interpolate user-controlled strings (e.g., `app_name`, `key`) directly into AppleScript commands executed via `osascript` without adequate sanitization. While no evidence of intentional malice was found, these flaws could be exploited to execute arbitrary shell commands if the AI agent is manipulated into using specially crafted application names or key combinations.
能力评估
Purpose & Capability
The skill is a macOS GUI automation tool and requests exactly the things needed for that: python3, pyobjc Vision, pyautogui, Pillow, use of screencapture/osascript, and macOS Screen Recording and Accessibility permissions. There are no unrelated binaries, credentials, or config paths requested.
Instruction Scope
SKILL.md and the included script instruct the agent to capture screenshots to /tmp, run on-device OCR, and move/click/type inside visible windows. The instructions do not reference unrelated files, external endpoints, or additional environment variables. It explicitly warns about typing secrets (clipboard) and documents the required macOS permissions.
Install Mechanism
Install uses Homebrew to ensure python3 is available and pip to install well-known Python packages from PyPI (pyobjc-framework-Vision, pyautogui, Pillow). No arbitrary downloads or obscure URLs are used. This is a standard install approach for a Python macOS automation script.
Credentials
No environment variables, secrets, or unrelated credentials are requested. The skill requires macOS accessibility and screen-recording permissions for the host process, which are proportional and necessary for GUI control and screenshot capture.
Persistence & Privilege
The skill does not set always:true and doesn't request to modify other skills or global agent configuration. It writes temporary artifacts to /tmp (annotated image and element JSON), which is consistent with its function. The only elevated privilege implication is granting Screen Recording and Accessibility to whichever host process runs the script (standard for this kind of automation).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install mac-use-1-0-0
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /mac-use-1-0-0 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of mac-use: visually control macOS GUI applications via screenshot, OCR, and interactive actions. - Provides commands to screenshot apps, detect clickable text elements, and annotate screenshots. - Supports `clicknum` (click by numbered element), direct coordinate clicks (`click`), scrolling, typing, and keypresses. - Includes a workflow for interacting with any GUI app: screenshot, interpret, interact, and verify. - Requires macOS with Python 3 (via Homebrew) and the built-in screencapture utility. - Uses Apple Vision framework for OCR to identify on-screen text elements. - Offers detailed instructions, command references, and workflow best practices for reliable macOS GUI automation.
元数据
Slug mac-use-1-0-0
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Mac Use 1.0.0 是什么?

Control macOS GUI apps visually — take screenshots, click, scroll, type. Use when the user asks to interact with any Mac desktop application's graphical inte... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 253 次。

如何安装 Mac Use 1.0.0?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install mac-use-1-0-0」即可一键安装,无需额外配置。

Mac Use 1.0.0 是免费的吗?

是的,Mac Use 1.0.0 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Mac Use 1.0.0 支持哪些平台?

Mac Use 1.0.0 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(darwin)。

谁开发了 Mac Use 1.0.0?

由 yidahis(@yidahis)开发并维护,当前版本 v1.0.0。

💬 留言讨论