Skip to main content

Give any AI Agent hands to control your Mac — auto-discover apps, generate CLI wrappers, return structured JSON.

Project description

  CLAM — CLI on Mac

中文 | English

Give any AI Agent hands to control your Mac.
Auto-discover apps. Generate CLI wrappers. Return structured JSON.


Your Mac has dozens of apps, but AI can't touch any of them. CLAM fixes that — it scans installed apps, generates typed CLI wrappers on the fly, and gives every command structured JSON output. No APIs, no manual adapters, no AppleScript headaches.

Install

pip install clam-mac

pip not found or externally-managed-environment error? macOS ships with pip3 (not pip), and Python 3.12+ blocks direct installs. Use a virtual environment:

python3 -m venv ~/clam-env
source ~/clam-env/bin/activate
pip install clam-mac

Add source ~/clam-env/bin/activate to your ~/.zshrc to make it permanent.

Quick Start

clam scan                       # discover controllable apps
clam install music              # generate CLI wrapper (~10s)
clam-music play                 # play music
clam-music --json get-current-track   # → structured JSON
clam-music set-sound-volume 50  # set volume

Fuzzy matching built in: chromegoogle-chrome, wordmicrosoft-word.

Use with AI Agents

OpenClaw

Install from ClawHub:

clawhub install clam-mac

Or add to your Lobster pipeline:

steps:
  - run: clam-music set-sound-volume 20
  - run: clam-music play
  - run: clam-finder open ~/Projects/current

Once installed, the AI auto-discovers apps via clam scan, installs wrappers, and executes commands.

Claude Code (MCP)

pip install clam-mac
claude mcp add clam -- clam-mcp

Then just ask:

"Set volume to 50 and tell me what song is playing"

Any Other Agent

CLAM generates standard CLI tools. Anything that can call shell commands works:

import subprocess, json
result = subprocess.run(["clam-music", "--json", "get-current-track"], capture_output=True, text=True)
track = json.loads(result.stdout)

How It Works

CLAM auto-selects the best automation mode for each app:

Mode Mechanism Apps Commands
Full .sdef scripting definitions Music, Finder, Chrome, Safari, Word Dozens to hundreds
UI Scripting Menu clicks via Accessibility Figma, Slack, VS Code, Spotify All menu items
Basic macOS standard suite DingTalk, WeChat, WPS Activate, quit, open, version

No configuration needed — clam install picks the right mode automatically.

Commands

clam scan              # list controllable apps
clam install <app>     # generate + install CLI wrapper
clam info <app>        # show available commands
clam doctor <app>      # check command reliability
clam list              # list installed wrappers
clam remove <app>      # uninstall wrapper

Troubleshooting

Problem Fix
clam-xxx not found source .venv/bin/activate or check your PATH
Permission denied System Settings > Privacy & Security > Automation
UI Scripting error System Settings > Privacy & Security > Accessibility
Only basic commands App has no scripting support — basic mode is the max

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

clam_mac-0.2.0.tar.gz (59.7 kB view details)

Uploaded Source

Built Distribution

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

clam_mac-0.2.0-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file clam_mac-0.2.0.tar.gz.

File metadata

  • Download URL: clam_mac-0.2.0.tar.gz
  • Upload date:
  • Size: 59.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clam_mac-0.2.0.tar.gz
Algorithm Hash digest
SHA256 748e88c4559e203b14a959b0a224c98dec8e48c1ef73c0a30aeaec824d92531f
MD5 f582923074775d941d25ce8b0645a2c6
BLAKE2b-256 058c5a5f9c440490285552b7a081afbdf8b11d8251c1f4d941b96c5d142e9f18

See more details on using hashes here.

File details

Details for the file clam_mac-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: clam_mac-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 57.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clam_mac-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fcbd7979c9f7690694ea09770e5c131e5966365a64d35edfbad66e5a11d9a57
MD5 c9ff885c6b63f2e6f990a7a7a135907a
BLAKE2b-256 6f83c2dd62a599c74a20d55b7905fb2cb369e0dfcb7bcf4ca2f2fa89aea0e98a

See more details on using hashes here.

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