Channels
How to Connect OpenClaw to iMessage
Browse more in Channels.
All channels guides →This guide shows you how to connect OpenClaw to iMessage using the legacy `imsg` CLI integration. You set up `imsg` on a Mac, wire it into the OpenClaw gateway, and approve the pairing flow so DMs and groups route into your agents.
By the end, you have OpenClaw sending and receiving iMessage traffic, including optional attachments, from a local or remote Mac.
Prerequisites
- ✓A Mac with Messages signed in on the account you want OpenClaw to use (the Mac runs `imsg`).
- ✓Homebrew installed on the Mac so you can install `imsg` with `brew install steipete/tap/imsg`.
- ✓Full Disk Access and Automation permission available for the process context that runs OpenClaw/`imsg` on macOS.
- ✓An OpenClaw gateway environment where you can run `openclaw gateway` and edit the `channels.imessage` configuration.
- ✓SSH access between your OpenClaw gateway host and the Mac if you plan to run `imsg` remotely over SSH or Tailscale.
Steps
- 1
Install and verify imsg on your Mac
Install the `imsg` CLI on the Mac that has iMessage signed in so OpenClaw can talk to Messages via JSON-RPC. Verifying `imsg rpc --help` confirms that the binary is present and supports the RPC mode OpenClaw needs.
bashbrew install steipete/tap/imsg imsg rpc --help - 2
Grant macOS permissions for Messages and automation
app. Run a one-time interactive `imsg` command in the same process context that will run the gateway so macOS shows the Full Disk Access and Automation prompts.
bashimsg chats --limit 1 # or imsg send <handle> "test" - 3
Configure OpenClaw to use the local imsg CLI
imessage` and pointing `cliPath` and `dbPath` at your Mac’s `imsg` binary and Messages database. This is the minimal config that lets the gateway spawn `imsg rpc` and read/write your iMessage chats.
json{ channels: { imessage: { enabled: true, cliPath: "/usr/local/bin/imsg", dbPath: "/Users/<you>/Library/Messages/chat.db", }, }, } - 4
Start the OpenClaw gateway with iMessage enabled
Start the gateway so it can spawn `imsg rpc` and begin probing the iMessage channel. Keep this process running while you test DMs, groups, and pairing.
bashopenclaw gateway - 5
Approve the first iMessage DM pairing
By default, iMessage DMs use pairing mode so unknown senders do not hit your agents automatically. List pending pairings and approve the code you want to trust before it expires after one hour.
bashopenclaw pairing list imessage openclaw pairing approve imessage <CODE> - 6
Optionally run imsg on a remote Mac over SSH
If your OpenClaw gateway runs on a different host, point `cliPath` at an SSH wrapper script that runs `imsg` on the remote Mac. This keeps the Messages database on the Mac while the gateway runs on Linux or another VM.
bash#!/usr/bin/env bash exec ssh -T gateway-host imsg "$@" - 7
Enable attachments and remote SCP fetches
When you want OpenClaw to ingest iMessage attachments, enable `includeAttachments` and configure attachment roots and `remoteHost`. This lets the gateway fetch media over SCP while enforcing path allowlists for security.
json{ channels: { imessage: { enabled: true, cliPath: "~/.openclaw/scripts/imsg-ssh", remoteHost: "user@gateway-host", // used for SCP attachment fetches includeAttachments: true, // Optional: override allowed attachment roots. // Defaults include /Users/*/Library/Messages/Attachments attachmentRoots: ["/Users/*/Library/Messages/Attachments"], remoteAttachmentRoots: ["/Users/*/Library/Messages/Attachments"], }, }, } - 8
Use Tailscale or multi-account patterns for production setups
For more isolated or scalable deployments, run `imsg` on a dedicated bot macOS user or a Mac in your tailnet. imessage` with the remote host, database path, and per-account overrides so each bot identity stays separate.
bash{ channels: { imessage: { enabled: true, cliPath: "~/.openclaw/scripts/imsg-ssh", remoteHost: "bot@mac-mini.tailnet-1234.ts.net", includeAttachments: true, dbPath: "/Users/bot/Library/Messages/chat.db", }, }, } #!/usr/bin/env bash exec ssh -T bot@mac-mini.tailnet-1234.ts.net imsg "$@"
Configuration
| Option | Description | Example |
|---|---|---|
| channels.imessage.enabled | Turns the iMessage channel on so the gateway spawns `imsg rpc` and handles iMessage traffic. | |
| channels.imessage.cliPath | Path to the `imsg` binary or wrapper script that OpenClaw runs for JSON-RPC over stdio. | /usr/local/bin/imsg |
| channels.imessage.dbPath | Filesystem path to the Messages chat database that `imsg` reads and writes. | /Users/bot/Library/Messages/chat.db |
| channels.imessage.remoteHost | Remote SSH host (`host` or `user@host`) used for SCP attachment fetches in remote `imsg` setups. | bot@mac-mini.tailnet-1234.ts.net |
| channels.imessage.includeAttachments | Controls whether inbound iMessage attachments are ingested by OpenClaw. | |
| channels.imessage.attachmentRoots | Local filesystem roots that attachment paths must match when ingesting media. | |
| channels.imessage.remoteAttachmentRoots | Remote filesystem roots used to validate attachment paths when fetching over SCP. | |
| channels.imessage.dmPolicy | Controls how direct messages are accepted, using modes like `pairing`, `allowlist`, `open`, or `disabled`. | pairing |
| channels.imessage.allowFrom | Allowlist of handles or chat targets that can DM the agent when `dmPolicy` or group fallbacks require it. | |
| channels.imessage.groupPolicy | Controls how group messages are handled, with options `allowlist`, `open`, or `disabled`. | allowlist |
| channels.imessage.groupAllowFrom | Allowlist of senders for group chats; falls back to `allowFrom` when unset. | |
| channels.imessage.groups | Explicit group configuration that can treat some multi-participant threads as group traffic even when `is_group=false`. | |
| channels.imessage.mediaMaxMb | Maximum outbound media size in megabytes for iMessage attachments. | |
| channels.imessage.textChunkLimit | Maximum text length per outbound iMessage chunk before OpenClaw splits the message. | |
| channels.imessage.chunkMode | Controls how outbound text is chunked, either `length` or `newline`. | length |
| channels.imessage.configWrites | Enables or disables channel-initiated config writes via `/config set|unset` when `commands.config: true`. | |
| channels.imessage.accounts | Per-account iMessage configuration block where each account can override paths, policies, and media settings. |
Troubleshooting
imsg not found or RPC unsupported
When the gateway cannot talk to iMessage, first confirm that `imsg` exists and supports the `rpc` subcommand. Run the RPC help and then probe the channel from OpenClaw; if the probe reports RPC unsupported, update `imsg` to a version with JSON-RPC support.
imsg rpc --help
openclaw channels status --probeDMs are ignored
If direct messages never reach your agent, check the DM policy and allowlist plus pairing approvals. allowFrom` allow the sender, and confirm the DM is paired with `openclaw pairing list imessage`.
openclaw pairing list imessageGroup messages are ignored
When groups stay silent, verify the group policy, sender allowlist, and group configuration. mentionPatterns` if you rely on mention gating.
Remote attachments fail
If attachments from a remote Mac never arrive, the SCP path or SSH trust is usually wrong. ssh/known_hosts`, and that the Messages attachment paths are readable on the Mac.
macOS permission prompts were missed
When `imsg` cannot read the Messages DB or send messages, you may have dismissed the macOS permission dialogs. Re-run `imsg` commands in an interactive GUI terminal in the same user/session context and approve the prompts, then confirm Full Disk Access and Automation for the process that runs OpenClaw/`imsg`.
imsg chats --limit 1
imsg send <handle> "test"Frequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.