mac_run
Run AppleScript, shell commands, clicks, typing, and keypresses on macOS to automate tasks. Enables AI agents to control a Mac without manual input.
Instructions
Run an AppleScript/JXA/shell command or send click/type/keypress to macOS.
Supported actionTypes: applescript, jxa, shell, open, click, type, keypress.
Examples:
Open Safari: { actionType: "open", target: "Safari" }
Type text: { actionType: "type", text: "hello world" }
Cmd+C: { actionType: "keypress", text: "cmd+c" }
Run AppleScript: { actionType: "applescript", script: 'tell application "Finder" to activate', appContext: "Finder" }
List files: { actionType: "shell", command: "ls -la ~/Documents" }
Limitations:
Requires Accessibility + Automation permissions for click/type/keypress and AS targeting other apps.
Cannot bypass the lock screen.
Dangerous shell patterns (rm -rf /, curl|sh, sudo, etc.) are blocked by the sandbox.
Set appContext for the best self-learning: errors get classified per-app and reliable hints are auto-prepended on subsequent calls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | X coordinate (required for click) | |
| y | No | Y coordinate (required for click) | |
| text | No | Text to type or key combo like "cmd+c" (required for type/keypress) | |
| dryRun | No | Validate without executing | |
| script | No | AppleScript or JXA code (required for applescript/jxa) | |
| target | No | App name, URL, or file path (required for open) | |
| command | No | Shell command (required for shell) | |
| timeout | No | Timeout in ms (100-30000, default: 10000) | |
| actionType | Yes | Type of action to execute | |
| appContext | No | Target application name for context |