iMessage(legacy: imsg)
ステータス: レガシーな外部CLI統合。Gatewayはimsg rpcを起動し、stdio上のJSON-RPCで通信します(別個のデーモンやポートはありません)。
BlueBubbles (recommended)
新しいセットアップ向けの推奨iMessage経路です。
Pairing
iMessageのDMはデフォルトでpairingモードです。
Configuration reference
iMessageフィールドの完全なリファレンスです。
クイックセットアップ
- Local Mac (fast path)
- Remote Mac over SSH
要件と権限(macOS)
imsgを実行するMacでMessagesにサインインしている必要があります。- OpenClaw/
imsgを実行するプロセスコンテキストにはフルディスクアクセスが必要です(Messages DBアクセス)。 - Messages.app経由でメッセージを送信するにはAutomation権限が必要です。
アクセス制御とルーティング
- DM policy
- Group policy + mentions
- Sessions and deterministic replies
channels.imessage.dmPolicyはダイレクトメッセージを制御します。pairing(デフォルト)allowlistopen(allowFromに"*"を含める必要があります)disabled
channels.imessage.allowFrom。allowlistエントリーには、ハンドルまたはチャットターゲット(chat_id:*、chat_guid:*、chat_identifier:*)を使用できます。ACP会話バインディング
レガシーiMessageチャットはACPセッションにもバインドできます。 高速なオペレーターフロー:- DMまたは許可されたグループチャット内で
/acp spawn codex --bind hereを実行します。 - 以後、同じiMessage会話内のメッセージは、生成されたACPセッションにルーティングされます。
/newおよび/resetは、同じバインド済みACPセッションをその場でリセットします。/acp closeはACPセッションを閉じ、バインディングを削除します。
bindings[]エントリーでtype: "acp"およびmatch.channel: "imessage"を使ってサポートされます。
match.peer.idには次を使用できます。
+15555550123やuser@example.comのような正規化済みDMハンドルchat_id:<id>(安定したグループバインディングに推奨)chat_guid:<guid>chat_identifier:<identifier>
デプロイパターン
Dedicated bot macOS user (separate iMessage identity)
Dedicated bot macOS user (separate iMessage identity)
専用のApple IDとmacOSユーザーを使い、botトラフィックを個人のMessagesプロフィールから分離します。一般的なフロー:
- 専用のmacOSユーザーを作成してサインインします。
- そのユーザーでbot用Apple IDを使ってMessagesにサインインします。
- そのユーザーに
imsgをインストールします。 - OpenClawがそのユーザーコンテキストで
imsgを実行できるようにSSHラッパーを作成します。 channels.imessage.accounts.<id>.cliPathと.dbPathをそのユーザープロファイルに向けます。
Remote Mac over Tailscale (example)
Remote Mac over Tailscale (example)
一般的なトポロジー:SSHキーを使用して、SSHとSCPの両方を非対話型にしてください。
まずホストキーが信頼されていることを確認してください(例:
- gatewayはLinux/VMで実行
- iMessage +
imsgはtailnet内のMacで実行 cliPathラッパーはSSHを使用してimsgを実行remoteHostはSCP添付ファイル取得を有効化
ssh bot@mac-mini.tailnet-1234.ts.net)。これによりknown_hostsが設定されます。Multi-account pattern
Multi-account pattern
iMessageは
channels.imessage.accounts配下のアカウント単位configをサポートします。各アカウントは、cliPath、dbPath、allowFrom、groupPolicy、mediaMaxMb、履歴設定、添付ファイルルートallowlistなどのフィールドを上書きできます。メディア、チャンク化、配信ターゲット
Attachments and media
Attachments and media
- 受信添付ファイルの取り込みは任意です:
channels.imessage.includeAttachments remoteHostが設定されている場合、リモート添付ファイルパスはSCP経由で取得できます- 添付ファイルパスは許可されたルートに一致する必要があります:
channels.imessage.attachmentRoots(ローカル)channels.imessage.remoteAttachmentRoots(リモートSCPモード)- デフォルトのルートパターン:
/Users/*/Library/Messages/Attachments
- SCPは厳格なホストキー検証を使用します(
StrictHostKeyChecking=yes) - 送信メディアサイズには
channels.imessage.mediaMaxMb(デフォルト16 MB)を使用します
Outbound chunking
Outbound chunking
- テキストチャンク上限:
channels.imessage.textChunkLimit(デフォルト4000) - チャンクモード:
channels.imessage.chunkModelength(デフォルト)newline(段落優先分割)
Addressing formats
Addressing formats
推奨される明示的ターゲット:
chat_id:123(安定したルーティングに推奨)chat_guid:...chat_identifier:...
imessage:+1555...sms:+1555...user@example.com
config書き込み
iMessageでは、デフォルトでチャンネル起点のconfig書き込みが許可されています(commands.config: trueのときの/config set|unset用)。
無効化する場合:
トラブルシューティング
imsg not found or RPC unsupported
imsg not found or RPC unsupported
バイナリとRPCサポートを検証します。probeでRPC未対応と表示された場合は、
imsgを更新してください。DMs are ignored
DMs are ignored
次を確認してください。
channels.imessage.dmPolicychannels.imessage.allowFrom- pairing承認(
openclaw pairing list imessage)
Group messages are ignored
Group messages are ignored
次を確認してください。
channels.imessage.groupPolicychannels.imessage.groupAllowFromchannels.imessage.groupsのallowlist動作- mentionパターン設定(
agents.list[].groupChat.mentionPatterns)
Remote attachments fail
Remote attachments fail
次を確認してください。
channels.imessage.remoteHostchannels.imessage.remoteAttachmentRoots- gatewayホストからのSSH/SCPキー認証
- gatewayホスト上の
~/.ssh/known_hostsにホストキーが存在すること - Messagesを実行しているMac上でのリモートパスの可読性
macOS permission prompts were missed
macOS permission prompts were missed
同じユーザー/セッションコンテキストの対話型GUIターミナルで再実行し、プロンプトを承認してください。OpenClaw/
imsgを実行するプロセスコンテキストに、フルディスクアクセスとAutomationが付与されていることを確認してください。設定リファレンスへのポインター
関連
- Channels Overview — サポートされているすべてのチャンネル
- Pairing — DM認証とpairingフロー
- Groups — グループチャットの動作とmentionゲーティング
- Channel Routing — メッセージのセッションルーティング
- Security — アクセスモデルとハードニング