Open source · Tools for agents
macos-cli
One signed Swift binary that gives a script or an AI agent the Mac's own apps from the terminal, and tells it plainly what it is allowed to touch.
What it does
I wanted my agents to read my calendar, find a contact or a mail, and look at the screen without a server running beside them or a pile of AppleScript I'd have to keep alive. macos-cli is the command for that: macos <area> <action> for Calendar, Contacts, Mail, Messages, Notes, Reminders, Safari, Photos, Music, files, windows, screenshots, OCR and the accessibility tree, where a button is clicked by its name instead of its coordinates. Every command that returns data takes --json, and under --json a failure is JSON too: one object with a stable error code, a message, a hint and an exit code an agent can branch on (64 usage, 3 not found, 4 not allowed, 5 no answer in time, 6 the app reported an error). It talks to the Mac's own frameworks. There is no daemon and no MCP server: an agent runs it the way you would, as a subprocess.
How the permissions work
macOS guards most of this behind privacy permissions, and I didn't want an agent guessing at them. macos doctor --for-agent answers in JSON, without triggering a single prompt: every area the binary may need (Calendars, Reminders, Contacts, Full Disk Access, Accessibility, Screen Recording, Location, and Automation for each app it drives), its state, the command a person runs to grant it, the binary's own signature, and whether anyone is at a terminal.
Granting stays with the person. macos authorize calendars shows the system prompt, or opens the right settings pane when macOS won't prompt again; a person clicks Allow, the agent can't. A command never waits on a prompt nobody can see: when no one is at a terminal, an undecided Calendars, Reminders or Contacts permission fails at once with access_denied and the command to run.
On top of macOS there is a policy of my own, ~/.config/macos-cli/auth.json, that turns capabilities on and off. Turning one off is a single command. Turning one on asks for a confirmation typed on the terminal itself, read from /dev/tty, so piped input can't answer it; without a terminal it refuses with person_required and the policy stays as it was. The agent the policy restricts can't lift it.
What changed in 0.9.0
- A signed and notarized release for Apple silicon, installed with Homebrew or one line, no Xcode.
macos updatereplaces it in place, so the permissions you granted stay. macos doctor --for-agentandmacos authorize <area>, as above.- Widening the policy needs a person:
auth grant,auth resetandauth setupask for a typed confirmation, andauth setup --yesis gone. - Calendars by id:
--calendar-idon events, export, create, update and delete, and a write to a calendar name two calendars share is refused instead of landing in the first one. - Mail by message id, and a search that asks Mail one query per mailbox instead of several Apple events per message. Contacts export no longer sorts, and Reminders update, delete and uncomplete look the reminder up by id instead of fetching all of them.
- A missing directory, PDF page, Space or audio device is exit 3, not a usage error, and Notes without Full Disk Access is an error now, never an empty list.
The full list is in the changelog.
Install
On macOS 13 or later, on Apple silicon:
brew install manuaudio/tap/macos-cli
Without Homebrew, the README has a one-line installer that checks the release's checksum and signature before it puts the binary in ~/.local/bin. Then macos doctor shows what is granted and what isn't.
For an agent, the repo carries a SKILL.md that teaches it the tool: check permissions first, then every command, which ones write, the error envelope and the exit codes. Claude Code, Codex, Cursor and the other agents skills.sh knows add it with one line:
npx skills add manuaudio/macos-cli
An agent's three calls
Recorded in a terminal on demo data: the permission check, a calendar read and a contact search, each answered in JSON.
The code
github.com/manuaudio/macos-cliMIT licensed. Issues are open on GitHub.