Skip to main content

Agent-first macOS automation CLI

Project description

fsq-mac

CI Python License

Agent-first macOS automation CLI for native app automation.

fsq-mac is a Python command-line tool for automating macOS applications through Appium Mac2. It is designed for agent and tool use: commands return structured output, sessions are managed explicitly, and higher-level workflows such as trace, replay, code generation, and plugins are built in.

Product position today:

  • native app automation first
  • browser chrome and simple web content are supported on a best-effort basis through accessibility
  • complex web DOM semantics are out of scope for the current backend

Why fsq-mac

  • Built for agent workflows: structured output, explicit sessions, and stable command surfaces instead of ad-hoc scripting glue.
  • More replayable than AppleScript, Hammerspoon, or coordinate-driven tools because it records locator-based UI actions, traces, and generated shell scripts.
  • More operationally predictable than one-off local scripts because daemon lifecycle, safety gating, trace capture, replay, code generation, and plugin discovery are part of the product.

Demo screenshots and GIF guidance live in docs/assets/README.md.

Install

Requires: macOS, Python 3.10+, Appium with Mac2 driver, and Accessibility permissions. See Quickstart for full setup instructions.

pip install fsq-mac

After installation, the CLI is available as mac.

Quickstart

Check the installed version:

mac --version

Run environment diagnostics:

mac doctor

Start a session:

mac session start

Inspect the current application and window:

mac app current --pretty
mac window current --pretty

Main workflow:

mac element inspect --pretty
mac element click --role AXButton --name OK
mac element type "hello world" --role AXTextField
mac capture screenshot

element inspect now returns a structured snapshot contract with fields such as snapshot_id, generation, backend, binding_mode, binding_warnings, and elements.

For native app flows, binding_warnings is often empty. For browser and web-content flows, warnings may include WEB_CONTENT_BEST_EFFORT, which means the current backend is using accessibility rather than DOM-native guarantees.

Examples

Start a session and inspect the current UI tree:

mac session start
mac element inspect --pretty
mac capture ui-tree

Work with the current application:

mac app current --pretty
mac window list
mac app list

Record and replay a trace:

mac trace start artifacts/traces/demo
mac trace stop
mac trace replay artifacts/traces/demo

Inspect and action responses are machine-consumable. Example success envelope:

{
  "ok": true,
  "command": "element.click",
  "session_id": "s1",
  "data": {
    "resolved_element": {"ref": "e0", "role": "AXButton", "name": "OK"},
    "actionability_used": {"actionable": true, "checks": {"has_ref": true, "has_geometry": true, "visible": true, "enabled": true}},
    "element_bounds": {"x": 10, "y": 20, "width": 80, "height": 40},
    "center": {"x": 50, "y": 40},
    "snapshot_status": "attached"
  },
  "error": null,
  "meta": {"backend": "appium_mac2", "duration_ms": 42}
}

Successful element actions can include:

  • resolved_element
  • actionability_used
  • element_bounds
  • center
  • snapshot_status
  • best-effort snapshot

Generate shell commands from a trace:

mac trace codegen artifacts/traces/demo

For repository screenshots and short GIF demos, see docs/assets/README.md.

Exit Codes

  • 0 — command succeeded (ok: true)
  • 1 — command failed (ok: false)

Prerequisites

fsq-mac requires:

  • macOS
  • Python 3.10+
  • Appium
  • appium-mac2-driver
  • Accessibility permissions granted to the terminal or host process running mac

Documentation

Examples

Development

For local development from source:

uv sync --group dev
uv run pytest tests/ -v

CI

GitHub Actions runs the repository test suite from .github/workflows/ci.yml. The CI workflow runs uv run pytest tests/ --junitxml=test-results/junit.xml and uploads test-results/junit.xml plus any generated artifacts/ directory as workflow artifacts.

Release

Releases are published to PyPI through GitHub Actions on tags matching v*.

See docs/releasing.md for the full release process. GitHub Releases can use the repository release note configuration in release.yml.

State Directory

Session and daemon state is stored in ~/.fsq-mac/.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsq_mac-0.3.0.tar.gz (179.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsq_mac-0.3.0-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file fsq_mac-0.3.0.tar.gz.

File metadata

  • Download URL: fsq_mac-0.3.0.tar.gz
  • Upload date:
  • Size: 179.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fsq_mac-0.3.0.tar.gz
Algorithm Hash digest
SHA256 40ebfe8a4e7188b17256b1c6d7d5f1bf93f70214631bdc5cff54824ad3ca9535
MD5 2ef30b0b56961fa52f962cfc20a71500
BLAKE2b-256 2393f8b81552ca7993e08274208f48acd14fdc89893a28260ed0949a2dff0459

See more details on using hashes here.

Provenance

The following attestation bundles were made for fsq_mac-0.3.0.tar.gz:

Publisher: publish.yml on houlianpi/fsq-mac

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fsq_mac-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fsq_mac-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 51.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fsq_mac-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed778533ebd61f72af8e22a2294e8384879480639f3dc57dad9c1e99f1ce8bb3
MD5 8714461943cc9c92b57bccff23120775
BLAKE2b-256 fc7257e38a8e04f92c7b11ea20b4936b0e8e75e51e20d566c81ef3009d46f7d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for fsq_mac-0.3.0-py3-none-any.whl:

Publisher: publish.yml on houlianpi/fsq-mac

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page