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.1.tar.gz (179.7 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.1-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fsq_mac-0.3.1.tar.gz
  • Upload date:
  • Size: 179.7 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.1.tar.gz
Algorithm Hash digest
SHA256 3c05bc9e3445baf243897bb1857cdf6f5360831691323dca4814d0d5e2077248
MD5 5e19f2531acacae4c0af2150e7bcced7
BLAKE2b-256 07468fd7c9cc48440146a7792c44e9c8cb6462197027c9c4ec6ae5bb242b37fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for fsq_mac-0.3.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: fsq_mac-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 002bc79ffa06d775611b4cb28501c8d7417c80b7258ce6cf3bc24e639ac07ad6
MD5 dfd68a7dc50af13f2c61ec4f752e1ecf
BLAKE2b-256 8f37a030c60836c5b0fe515e84ed38bdd067605f0cae79eb664a326abe569095

See more details on using hashes here.

Provenance

The following attestation bundles were made for fsq_mac-0.3.1-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