iMessage (legacy: imsg)
Status: legacy external CLI integration. Gateway spawnsimsg rpc and communicates over JSON-RPC on stdio (no separate daemon/port).
BlueBubbles (recommended)
Preferred iMessage path for new setups.
Pairing
iMessage DMs default to pairing mode.
Configuration reference
Full iMessage field reference.
Quick setup
- Local Mac (fast path)
- Remote Mac over SSH
Requirements and permissions (macOS)
- Messages must be signed in on the Mac running
imsg. - Full Disk Access is required for the process context running OpenClaw/
imsg(Messages DB access). - Automation permission is required to send messages through Messages.app.
Access control and routing
- DM policy
- Group policy + mentions
- Sessions and deterministic replies
channels.imessage.dmPolicy controls direct messages:pairing(default)allowlistopen(requiresallowFromto include"*")disabled
channels.imessage.allowFrom.Allowlist entries can be handles or chat targets (chat_id:*, chat_guid:*, chat_identifier:*).Deployment patterns
Dedicated bot macOS user (separate iMessage identity)
Dedicated bot macOS user (separate iMessage identity)
Use a dedicated Apple ID and macOS user so bot traffic is isolated from your personal Messages profile.Typical flow:
- Create/sign in a dedicated macOS user.
- Sign into Messages with the bot Apple ID in that user.
- Install
imsgin that user. - Create SSH wrapper so OpenClaw can run
imsgin that user context. - Point
channels.imessage.accounts.<id>.cliPathand.dbPathto that user profile.
Remote Mac over Tailscale (example)
Remote Mac over Tailscale (example)
Common topology:Use SSH keys so both SSH and SCP are non-interactive.
Ensure the host key is trusted first (for example
- gateway runs on Linux/VM
- iMessage +
imsgruns on a Mac in your tailnet cliPathwrapper uses SSH to runimsgremoteHostenables SCP attachment fetches
ssh bot@mac-mini.tailnet-1234.ts.net) so known_hosts is populated.Multi-account pattern
Multi-account pattern
iMessage supports per-account config under
channels.imessage.accounts.Each account can override fields such as cliPath, dbPath, allowFrom, groupPolicy, mediaMaxMb, history settings, and attachment root allowlists.Media, chunking, and delivery targets
Attachments and media
Attachments and media
- inbound attachment ingestion is optional:
channels.imessage.includeAttachments - remote attachment paths can be fetched via SCP when
remoteHostis set - attachment paths must match allowed roots:
channels.imessage.attachmentRoots(local)channels.imessage.remoteAttachmentRoots(remote SCP mode)- default root pattern:
/Users/*/Library/Messages/Attachments
- SCP uses strict host-key checking (
StrictHostKeyChecking=yes) - outbound media size uses
channels.imessage.mediaMaxMb(default 16 MB)
Outbound chunking
Outbound chunking
- text chunk limit:
channels.imessage.textChunkLimit(default 4000) - chunk mode:
channels.imessage.chunkModelength(default)newline(paragraph-first splitting)
Addressing formats
Addressing formats
Preferred explicit targets:
chat_id:123(recommended for stable routing)chat_guid:...chat_identifier:...
imessage:+1555...sms:+1555...user@example.com
Config writes
iMessage allows channel-initiated config writes by default (for/config set|unset when commands.config: true).
Disable:
Troubleshooting
imsg not found or RPC unsupported
imsg not found or RPC unsupported
Validate the binary and RPC support:If probe reports RPC unsupported, update
imsg.DMs are ignored
DMs are ignored
Check:
channels.imessage.dmPolicychannels.imessage.allowFrom- pairing approvals (
openclaw pairing list imessage)
Group messages are ignored
Group messages are ignored
Check:
channels.imessage.groupPolicychannels.imessage.groupAllowFromchannels.imessage.groupsallowlist behavior- mention pattern configuration (
agents.list[].groupChat.mentionPatterns)
Remote attachments fail
Remote attachments fail
Check:
channels.imessage.remoteHostchannels.imessage.remoteAttachmentRoots- SSH/SCP key auth from the gateway host
- host key exists in
~/.ssh/known_hostson the gateway host - remote path readability on the Mac running Messages
macOS permission prompts were missed
macOS permission prompts were missed
Re-run in an interactive GUI terminal in the same user/session context and approve prompts:Confirm Full Disk Access + Automation are granted for the process context that runs OpenClaw/
imsg.