Your agent finally gets a phone number: iMessage from the terminal
imsg turns Messages.app into a JSON-RPC service so scripts and agents can read, watch, and send texts like any other API.

What it does
imsg is a Swift CLI that reads ~/Library/Messages/chat.db directly for chats, history, search, and attachments, streams new messages via filesystem events (with a polling fallback for when macOS drops them), and sends texts, files, and tapbacks by driving Messages.app through its public AppleScript surface. Everything emits one JSON object per line, and imsg rpc wraps it all in JSON-RPC 2.0 over stdio for long-running agent processes.
The interesting bit
The boring part is where the value is: it deliberately avoids private send APIs for the core workflow, so plain send/watch/history needs nothing scarier than Full Disk Access and Automation permission. The spicy stuff — typing indicators, read receipts, edit/unsend, group management, rich sends — is quarantined behind an opt-in dylib injection into Messages.app that requires SIP disabled, a manual port of the BlueBubbles private-API surface.
Key highlights
- Local-first reads straight from
chat.db— no daemon, no network round-trip imsg watchstreams new messages with tapback events, resumable via--since-rowid- Attachment metadata with optional CAF→M4A and GIF→PNG conversion so models can actually consume them
imsg completions llmships in-context CLI help for agents- Linux builds work read-only against a copied
chat.db
Caveats
- Advanced IMCore features need SIP off, and macOS 26/Tahoe can block the injection via library validation
- AppleScript can’t force a specific outgoing Apple ID or inline reply target — routing fields are read-only diagnostics
- Human-readable progress goes to stderr, but you’ll still be fighting macOS permission dialogs (the README has a whole troubleshooting liturgy)
Verdict
If you’re building a Mac-based agent or automation that needs to text humans, this is the most honest bridge to Messages.app you’ll find. If you’re not on macOS or unwilling to grant Full Disk Access, move along.
Frequently asked
- What is openclaw/imsg?
- imsg turns Messages.app into a JSON-RPC service so scripts and agents can read, watch, and send texts like any other API.
- Is imsg open source?
- Yes — openclaw/imsg is open source, released under the MIT license.
- What language is imsg written in?
- openclaw/imsg is primarily written in Swift.
- How popular is imsg?
- openclaw/imsg has 1.4k stars on GitHub and is currently cooling off.
- Where can I find imsg?
- openclaw/imsg is on GitHub at https://github.com/openclaw/imsg.