Table of Contents

Introduction

These notes discuss the installation of the Mautrix iMessage bridge. This will involve installing a websocket proxy and the bridge component on a Mac (or other system running macOS), and setting up a VPN between the Mac and your Synapse server using ZeroTier.

Note

This bridge, at least as configured following these instructions, can only bridge a single iMessage user. You may be able to adapt these instructions to bridge to multiple users, but I can't give any assistance on that area, at least at this time.

Prerequisites

Installing ZeroTier

On your Synapse server

curl -s 'https://raw.githubusercontent.com/zerotier/ZeroTierOne/master/doc/contact%40zerotier.com.gpg' | gpg --import && \ if z=$(curl -s 'https://install.zerotier.com/' | gpg); then echo "$z" | sudo bash; fi

On your Mac

Download the installer from zerotier.com and install it

Set up the network

Install Barcelona

Barcelona is a component used by the bridge to interface with the iMessage service, and it will need to be built from source code. You’ll need to run these commands from your preferred terminal on the Mac:

Install the bridge

This step is done on the Mac. First, browse to https://mau.dev/mautrix/imessage/pipelines?scope=branches&page=1. Download the latest (i.e., first on the list) build from the master branch, with the appropriate architecture. If you don’t know, download the one that says build universal:archive. Unzip it.

Register the App service on your Synapse server

Installing wsproxy

Compiled binaries for macOS aren’t available for download for wsproxy, so you’ll need to compile it yourself. To do this, first go to https://go.dev and download (and install) Go for macOS. Then:

Configure Synapse to register this bridge

These steps need to be taken on whatever machine you’re using to run the Ansible playbook. First, edit vars.yaml, and add the following to the end:

# App service registration file for mautrix-imessage 
matrix_synapse_container_extra_arguments:
- ‘–mount type=bind,src=/matrix/mautrix-imessage/config/registration.yaml,dst=/matrix-mautrix-imessage-registration.yaml,ro’ 
matrix_synapse_app_service_config_files:
- /matrix-mautrix-imessage-registration.yaml

Then, re-run the playbook with ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start.

Test

Once that completes, test it out quickly. Back on the Mac, open two terminal windows. In the first, run ~/src/mautrix-wsproxy/mautrix-wsproxy. In the second, run ~/src/mautrix-imessage/mautrix-imessage. If the latter starts up successfully, press Ctrl-C to terminate each of them.

Start wsproxy and the bridge automatically

Back on the Mac, create ~/mautrix-imessage.plist. Its contents should be:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 
<plist version="1.0">
<dict>
 
    <key>Label</key>
    <string>com.github.mautrix-imessage</string>
 
    <key>WorkingDirectory</key>
    <string>/Users/<you>/src/mautrix-imessage</string>
 
    <key>ProgramArguments</key>
    <array>
    <string>./mautrix-imessage</string>
    <string>--config</string>
    <string>config.yaml</string>
    </array>
 
    <key>RunAtLoad</key>
    <true/>
 
    <key>KeepAlive</key>
    <true/>
 
</dict>
</plist>

…where <you> is your username on the Mac. Then create ~/mautrix-wsproxy.plist. Its contents should be:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 
<plist version="1.0">
<dict>
 
    <key>Label</key>
    <string>com.github.mautrix-wsproxy</string>
 
    <key>WorkingDirectory</key>
    <string>/Users/<you>/src/mautrix-wsproxy</string>
 
    <key>ProgramArguments</key>
    <array>
    <string>./mautrix-wsproxy</string>
    <string>-config</string>
    <string>config.yaml</string>
    </array>
 
    <key>RunAtLoad</key>
    <true/>
 
    <key>KeepAlive</key>
    <true/>
 
</dict>
</plist>

Then, at your favorite terminal:

Test again

Log in to your homeserver using whatever client app you like, and send a message to @imessagebot:example.com, where example.com is the domain of your homeserver.