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
pipnot found orexternally-managed-environmenterror? macOS ships withpip3(notpip), and Python 3.12+ blocks direct installs. Use a virtual environment:python3 -m venv ~/clam-env source ~/clam-env/bin/activate pip install clam-macAdd
source ~/clam-env/bin/activateto your~/.zshrcto 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: chrome → google-chrome, word → microsoft-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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
748e88c4559e203b14a959b0a224c98dec8e48c1ef73c0a30aeaec824d92531f
|
|
| MD5 |
f582923074775d941d25ce8b0645a2c6
|
|
| BLAKE2b-256 |
058c5a5f9c440490285552b7a081afbdf8b11d8251c1f4d941b96c5d142e9f18
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fcbd7979c9f7690694ea09770e5c131e5966365a64d35edfbad66e5a11d9a57
|
|
| MD5 |
c9ff885c6b63f2e6f990a7a7a135907a
|
|
| BLAKE2b-256 |
6f83c2dd62a599c74a20d55b7905fb2cb369e0dfcb7bcf4ca2f2fa89aea0e98a
|