Connect OpenClaw to iMessage
Use your AI assistant directly through Apple Messages on macOS. Supports both iMessage and SMS.
The iMessage integration requires macOS with the Messages app configured. It uses the imsg CLI tool to read from the local Messages database.
- +Native Apple Integration — Works with your existing Messages app
- +iMessage + SMS — Supports both protocols seamlessly
- +Read Receipts — Know when messages are delivered and read
- +Reactions — iMessage reactions are supported
- +Group Chats — Participate in group conversations
- +Remote Gateway — Can work via SSH to a remote Mac
- 1.macOS
With the Messages app configured and signed into your Apple ID
- 2.Full Disk Access Permission
Required for OpenClaw to read ~/Library/Messages/chat.db
- 3.imsg CLI
Command-line tool for interacting with Messages
Setup Steps
Install imsg CLI
Install the imsg command-line tool that OpenClaw uses to interact with Messages:
brew install imsg
Or download from the imsg GitHub releases page
Grant Full Disk Access
OpenClaw needs permission to read the Messages database:
- - Open System Settings (or System Preferences)
- - Go to Privacy & Security > Full Disk Access
- - Click the + button and add Terminal (or iTerm)
- - Also add the OpenClaw executable if running as a binary
Configure OpenClaw
Add the iMessage configuration to your openclaw.json config file:
{
"channels": {
"imessage": {
"enabled": true,
"cliPath": "imsg",
"dbPath": "~/Library/Messages/chat.db",
"allowFrom": ["+15555550123", "user@example.com"]
}
}
}Set Up allowFrom
Specify who can interact with your bot:
- - Phone numbers with country code: +15555550123
- - Apple IDs (email addresses): user@example.com
Test the Connection
Verify the iMessage channel is working:
openclaw channels status imessage
Then send a message from an allowed contact to test the integration.
Full configuration options for the iMessage channel:
{
"channels": {
"imessage": {
"enabled": true,
"cliPath": "imsg",
"dbPath": "~/Library/Messages/chat.db",
"remoteHost": "user@gateway-host",
"dmPolicy": "pairing",
"allowFrom": ["+15555550123", "user@example.com"],
"historyLimit": 50,
"includeAttachments": false,
"mediaMaxMb": 16,
"service": "auto",
"region": "US"
}
}
}cliPath— Path to the imsg CLI executabledbPath— Path to the Messages databaseremoteHost— SSH host for remote gateway setupdmPolicy— How to handle direct messagesallowFrom— Phone numbers or Apple IDs allowed to messagehistoryLimit— Number of messages to include as contextincludeAttachments— Enable attachment handlingmediaMaxMb— Maximum attachment size in MBservice— Force iMessage or SMS, or use autoregion— Region for phone number formatting
If you want to run OpenClaw on a server but access iMessage from a Mac at home, you can use SSH:
{
"channels": {
"imessage": {
"enabled": true,
"remoteHost": "user@your-mac.local",
"cliPath": "/usr/local/bin/imsg"
}
}
}- - Ensure SSH key authentication is set up
- - The Mac must be always on and connected
- - imsg and Full Disk Access must be configured on the Mac
Permission denied when reading chat.db?
Make sure you have granted Full Disk Access to Terminal/iTerm and the OpenClaw executable. You may need to restart the terminal after granting access.
Bot not responding to messages?
Verify the phone number or Apple ID in allowFrom matches exactly. Phone numbers need the + and country code.
Can't find chat.db?
The default path is ~/Library/Messages/chat.db. Make sure the Messages app has been opened at least once and you are signed in.
imsg command not found?
Ensure imsg is installed and in your PATH. You can specify the full path in cliPath.
Remote gateway not connecting?
Verify SSH key authentication works with ssh user@host and that the remote Mac has imsg installed with Full Disk Access.
iMessage Connected!
Add more channels or configure skills to customize your AI assistant.