This setup lets you manage iMessage on your Mac through OpenClaw.
Architecture
┌──────────────────────────────┐ SSH (imsg rpc) ┌──────────────────────────┐
│ Gateway host (Linux/VM) │──────────────────────────────────▶│ Mac with Messages + imsg │
│ - clawdbot gateway │ SCP (attachments) │ - Messages signed in │
│ - channels.imessage.cliPath │◀──────────────────────────────────│ - Remote Login enabled │
└──────────────────────────────┘ └──────────────────────────┘
▲
│ Tailscale tailnet (hostname or 100.x.y.z)
▼
user@gateway-host
Billing
Deploying and using the OpenClaw service on a Simple Application Server instance incurs the following fees:
Simple Application Server fees: For more information, see Simple Application Server billing overview.
Model invocation fees: These fees are determined by the model provider that you choose and the pricing of the corresponding model.
Procedure
Configure Tailscale
-
You must configure Tailscale on your Mac and server to connect them. The first step is to register on Tailscale.
-
Download and install Tailscale on your Mac from the download page.
Requires macOS Monterey 12.0 or later. You can also download Tailscale from the macOS App Store.
-
After installation, start Tailscale from the command line:
/Applications/Tailscale.app/Contents/MacOS/Tailscale up -
To install Tailscale on your Linux server, go to the admin console, get the installation script, and run it.
On the Tailscale admin console, go to the Machines page. Click the Add device button in the upper-right corner and select Linux server from the drop-down menu to get the installation script.
Set Auth key expiration to
7days (optional, 1–90 days). Then click Generate install script. -
After the script completes, your Mac and Linux server are on the same local area network.
On the Tailscale admin console, go to the Machines page and confirm that both devices show Connected status.
-
Tailscale may overwrite the DNS settings on your Linux server, causing network issues. To fix this, configure a new nameserver, such as
1.1.1.1or8.8.8.8.On the top navigation bar of the Tailscale admin console, click the DNS tab.
On the Nameservers page on the Tailscale admin console, add Google Public DNS and Cloudflare Public DNS in the Global nameservers section, and enable Override DNS servers.
Configure your Mac
-
Enable Remote Login on your Mac. Go to .
-
Grant sshd-keygen-wrapper Full Disk Access. Go to .
-
Make sure you are signed in to iMessage on your Mac.
Configure Clawdbot
-
Edit the configuration file at
/root/.clawdbot/clawdbot.jsonand add thechannelconfiguration.{ "channels": { "imessage": { "enabled": true, "cliPath": "/root/.clawdbot/scripts/imsg-ssh", "dbPath": "/Users/{{YOUR_USER_NAME}}/Library/Messages/chat.db", "remoteHost": "{{YOUR_USER_NAME}}@{{YOUR_MAC_MAGIC_DNS}}", "dmPolicy": "pairing", "groupPolicy": "allowlist", "includeAttachments": true } } }Note the following parameters:
-
YOUR_USER_NAME: Replace with your Mac username.
-
YOUR_MAC_MAGIC_DNS: Replace with the Magic DNS name for your Mac in Tailscale.
Sign in to the Tailscale admin console, go to the Machines page, and enter your Mac's device name in the search box. The drop-down list shows various address formats for the device, such as hostname, Magic DNS name, IPv6 address, and IPv4 address. The Magic DNS address is the entry that includes your tailnet domain suffix, such as
macbook-pro.your-tailnet.ts.net. Copy this address and paste it into theremoteHostconfiguration parameter. -
-
Create
/root/.clawdbot/scripts/imsg-ssh. This script forwards commands to your Mac overssh. Replace {{YOUR_USER_NAME}}@{{YOUR_MAC_MAGIC_DNS}} with the remoteHost value you configured in the previous step. Then make the file executable.#!/usr/bin/env bash exec ssh -T {{YOUR_USER_NAME}}@{{YOUR_MAC_MAGIC_DNS}} /usr/local/bin/imsg "$@" -
You can now test the connection to your Mac by running
ssh {{YOUR_USER_NAME}}@{{YOUR_MAC_MAGIC_DNS}}. You will be prompted for your password. You can also set up SSH key authentication to enable passwordless access from the Linux server to the Mac. -
Start and initialize the gateway:
cd /home/clawdbot/ pnpm clawdbot onboard --install-daemon
Results
-
Connect to Chat through the text-based user interface (TUI).
-
Enter: Send a poem to +86188xxxxxxxx using iMessage. Your Mac sends a poem to the specified account.
If you need further assistance, please let me know! Wake up, my friend! Hello! I'm awake. How can I assist you today? Who are you? I am your personal assistant, ready to help you with various tasks like sending messages, managing your schedule, and finding information. If there's anything you need, just let me know! Send a poem by Li Bai to +86188xxx via iMessage A poem by Li Bai, "Quiet Night Thought", has been sent to +86188xxx via iMessage: Quiet Night Thought Moonlight before my bed, Could it be frost on the ground? I lift my head to watch the moon, Then lower it, thinking of home. — Li Bai connected | idle agent main | session main (imessage:+86188xxx) | qwen-portal...