Skip to main content

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

Metadata

Release files for fsq-mac 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fsq-mac 0.3.1
File Size Uploaded Provenance Actions
fsq_mac-0.3.1.tar.gz 179.7 kB With provenance Details for fsq_mac-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fsq-mac 0.3.1
File Interpreter ABI Platform Actions
fsq_mac-0.3.1-py3-none-any.whl Python 3 none any Details for fsq_mac-0.3.1-py3-none-any.whl

Total release size: 231.2 kB

Release files / fsq_mac-0.3.1.tar.gz

Download URL fsq_mac-0.3.1.tar.gz
Size 179.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c05bc9e3445baf243897bb1857cdf6f5360831691323dca4814d0d5e2077248
BLAKE2b-256 checksum
How to use checksums
07468fd7c9cc48440146a7792c44e9c8cb6462197027c9c4ec6ae5bb242b37fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Release files / fsq_mac-0.3.1-py3-none-any.whl

Download URL fsq_mac-0.3.1-py3-none-any.whl
Size 51.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
002bc79ffa06d775611b4cb28501c8d7417c80b7258ce6cf3bc24e639ac07ad6
BLAKE2b-256 checksum
How to use checksums
8f37a030c60836c5b0fe515e84ed38bdd067605f0cae79eb664a326abe569095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

Security for fsq-mac 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fsq_mac-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page