### Install All Optional Dependencies from Requirements File Source: https://docs.mau.fi/bridges/print.html Install all optional dependencies by using the optional-requirements.txt file. This is an alternative to specifying '[all]' during pip install. ```bash pip install --upgrade -r optional-requirements.txt ``` -------------------------------- ### Generate Example Configuration Source: https://docs.mau.fi/bridges/go/setup.html?bridge=signal Use this command to generate an example configuration file for mautrix-signal. The generated file can then be customized. ```bash ./mautrix-signal -e ``` -------------------------------- ### Generate Example Configuration Source: https://docs.mau.fi/bridges/go/setup.html Use this command to generate an example configuration file for the bridge. This file can then be edited to suit your needs. ```bash ./mautrix-$bridge -e ``` -------------------------------- ### Install Development Dependencies Source: https://docs.mau.fi/bridges/print.html Install all dependencies required for development, including linters like Black and isort. ```bash pip install --upgrade -r requirements.txt ``` -------------------------------- ### Install Android SDK Components Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Installs necessary command-line tools for the Android SDK, including platform-tools, emulator, and specific platform and system image versions. Ensure OpenJDK8 is installed as it's currently required. ```bash ./tools/bin/sdkmanager --install platform-tools emulator ./tools/bin/sdkmanager --install "platforms;android-24" ./tools/bin/sdkmanager --install "system-images;android-24;default;armeabi-v7a" ``` -------------------------------- ### Install Specific Optional Dependencies Source: https://docs.mau.fi/bridges/print.html Install only specific optional dependencies by replacing 'all' with a comma-separated list of pip extra names. ```bash pip install --upgrade mautrix-$bridge[sqlite,speedups] ``` -------------------------------- ### Install mautrix-bridge from Git Source: https://docs.mau.fi/bridges/python/setup.html Install the bridge directly from the master branch of the GitHub repository. This is useful for testing the latest development version. ```bash pip install --upgrade mautrix-$bridge[all]@git+https://github.com/mautrix/$bridge.git ``` -------------------------------- ### Configure Systemd Service for Mautrix Bridge Source: https://docs.mau.fi/bridges/python/setup.html Create a systemd service file to manage the Mautrix bridge process. This ensures the bridge runs as a system service, starts on boot, and is managed by systemd. Adjust WorkingDirectory and User if the default setup differs. ```systemd [Unit] Description=mautrix-$bridge bridge [Service] # N.B. If you didn't create a user with the correct home directory, set this # to the directory where config.yaml is (e.g. /opt/mautrix-$bridge). WorkingDirectory=~ ExecStart=/opt/mautrix-$bridge/bin/python -m mautrix_$bridge User=mautrix-$bridge [Install] WantedBy=multi-user.target ``` -------------------------------- ### Install libheif with Dev Headers Source: https://docs.mau.fi/bridges/print.html Optionally install libheif with development headers using Homebrew. This is required for HEIF to JPEG conversion. ```bash brew install libheif ``` -------------------------------- ### Install libolm3 with Dev Headers Source: https://docs.mau.fi/bridges/print.html Install the libolm3 library along with its development headers using Homebrew. This is a prerequisite for compiling the bridge manually. ```bash brew install libolm ``` -------------------------------- ### Run the mautrix-bridge Source: https://docs.mau.fi/bridges/python/setup.html Start the bridge application. Ensure you are in the activated virtual environment and have configured 'config.yaml'. ```bash python -m mautrix_$bridge ``` -------------------------------- ### Run the Bridge Source: https://docs.mau.fi/bridges/go/setup.html Execute this command to start the mautrix bridge after configuration and registration are complete. ```bash ./mautrix-$bridge ``` -------------------------------- ### Install Development Dependencies Source: https://docs.mau.fi/bridges/python/setup.html Install dependencies required for development, including linting tools like Black and isort, and pre-commit hooks. ```bash pip install -r dev-requirements.txt ``` -------------------------------- ### Activate Virtual Environment Source: https://docs.mau.fi/bridges/print.html Activate the created virtual environment before proceeding with installations. ```bash source ./bin/activate ``` -------------------------------- ### Install mautrix-bridge with Optional Dependencies Source: https://docs.mau.fi/bridges/python/setup.html Install the bridge using pip, including all optional dependencies. This command assumes you are inside an activated virtual environment. ```bash pip install --upgrade mautrix-$bridge[all] ``` -------------------------------- ### Install Linting Dependencies and Git Hook Source: https://docs.mau.fi/bridges/print.html Install development-specific dependencies for code formatting and set up pre-commit hooks to ensure code quality. ```bash pip install -r dev-requirements.txt ``` ```bash pre-commit install ``` -------------------------------- ### Install Bridge Dependencies for Development Source: https://docs.mau.fi/bridges/python/setup.html Install dependencies for running the bridge from a cloned repository. This includes core dependencies and optionally, extra requirements. ```bash pip install --upgrade -r requirements.txt ``` ```bash pip install --upgrade -r requirements.txt -r optional-requirements.txt ``` -------------------------------- ### iOS Bridge Configuration Example Source: https://docs.mau.fi/bridges/print.html Configuration steps for setting up mautrix-imessage on iOS, including filling out the homeserver details, user MXID, platform, and generating tokens. Also includes generating a QR code for scanning with Brooklyn. ```bash echo -n https://user:pass@example.com/your-config.yaml | qrencode -t ansiutf8 ``` -------------------------------- ### Start WhatsApp main activity Source: https://docs.mau.fi/bridges/print.html Use this command to launch the WhatsApp main activity within the emulator. This can be useful for restarting the app or if the AVD becomes unresponsive. You can optionally specify the device serial. ```bash adb [-s DEVICE_SERIAL] shell am start -n 'com.whatsapp/.HomeActivity' ``` -------------------------------- ### Feed Desktop to Virtual Webcam using ffmpeg Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Uses ffmpeg to capture the desktop screen (starting at coordinates 10,20 with a resolution of 640x480) and stream it to the virtual webcam device `/dev/video0`. Ensure the virtual device is correctly set up and accessible. ```bash ffmpeg -f x11grab -s 640x480 -i :0.0+10,20 -vf format=pix_fmts=yuv420p -f v4l2 /dev/video0 ``` -------------------------------- ### Install Python-OLM from GitLab PyPI Source: https://docs.mau.fi/bridges/python/optional-dependencies.html Use this command to install the python-olm package from a specific index URL, which may be necessary to avoid build issues with development headers. ```bash pip install python-olm --extra-index-url https://gitlab.matrix.org/api/v4/projects/27/packages/pypi/simple ``` -------------------------------- ### Install WhatsApp APK using ADB Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Use ADB to install the WhatsApp APK onto the Android emulator. Ensure the emulator is running and accessible via ADB. ```bash adb install APK_FILE ``` -------------------------------- ### Clone and Build Bridge from Source Source: https://docs.mau.fi/bridges/go/setup.html Clone the bridge repository and use the provided build script to compile the executable. Ensure necessary development headers are installed for encryption support. ```bash git clone https://github.com/mautrix/$bridge.git mautrix-$bridge cd mautrix-$bridge ./build.sh ``` ```bash ./build.sh -tags nocrypto ``` ```bash ./build.sh -tags goolm ``` -------------------------------- ### Clone the mautrix-imessage repository Source: https://docs.mau.fi/bridges/go/imessage/mac/setup.html Use this command to get the source code for the bridge. Ensure you have Git installed. ```bash git clone https://github.com/mautrix/imessage.git ``` -------------------------------- ### Run AVD with Options Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Launches an Android Virtual Device (AVD) from the command line with various options. Useful flags include `-no-audio`, `-no-window` for headless operation, `-show-kernel` for boot logs, `-no-snapshot` for cold boot, and `-memory MB` to set RAM. ```bash ./emulator/emulator -avd AVD_NAME [options] ``` -------------------------------- ### Download Prebuilt Executable (Releases) Source: https://docs.mau.fi/bridges/print.html Download prebuilt bridge binaries from the GitHub releases page. Select the binary corresponding to your system architecture. ```bash https://github.com/mautrix/$bridge/releases ``` -------------------------------- ### Initial Docker Container Run for Configuration Source: https://docs.mau.fi/bridges/general/docker-setup.html Run the Docker container for the first time to generate the initial configuration file. This command mounts the current directory as `/data` within the container. Ensure you are in the bridge's directory or use an absolute path. ```bash docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/$bridge: ``` -------------------------------- ### Download Precompiled libsignal_ffi.a Source: https://docs.mau.fi/bridges/print.html For mautrix-signal, download a precompiled libsignal_ffi.a from the mau.dev CI if you don't want to compile libsignal yourself. Place it in a directory included in LIBRARY_PATH. ```bash Linux amd64, Linux arm64, macOS arm64 ``` -------------------------------- ### Install Android App via ADB Source: https://docs.mau.fi/bridges/go/imessage/android/setup.html Compile and install the Android SMS bridge app onto your device using Gradle and ADB. This command assumes you have the Android SDK and NDK set up. ```shell ./gradlew installDebug ``` -------------------------------- ### Compile the mautrix-imessage bridge Source: https://docs.mau.fi/bridges/go/imessage/mac/setup.html After cloning the repository, run this script to compile the bridge. This requires Go 1.19+ and will fetch dependencies. ```bash ./build.sh ``` -------------------------------- ### Create Bridge User Source: https://docs.mau.fi/bridges/go/setup.html This command creates a system user for the bridge. Ensure this user and its home directory are used in the setup instructions. ```bash sudo adduser --system mautrix-$bridge --home /opt/mautrix-$bridge ``` -------------------------------- ### Build mautrix-imessage bridge Source: https://docs.mau.fi/bridges/go/imessage/mac-nosip/setup.html Navigate into the cloned directory and run the build script to fetch dependencies and compile the bridge. ```bash cd mautrix-imessage ./build.sh ``` -------------------------------- ### Setting Appservice Token Secret Source: https://docs.mau.fi/bridges/print.html Set the appservice token as a secret in the double_puppet configuration. This is typically done after installing the new registration file. ```yaml double_puppet: ... secrets: your.domain: "as_token:meow" ... ``` -------------------------------- ### Register Signal Account with signal-cli Source: https://docs.mau.fi/bridges/go/signal/authentication.html Use this command to register a new Signal account using signal-cli. Ensure you have the latest release installed. ```bash signal-cli -u +123456789 register ``` -------------------------------- ### Activate Python Virtual Environment Source: https://docs.mau.fi/bridges/python/setup.html Activate the virtual environment before installing dependencies or running the bridge. This command needs to be run in the directory containing the virtual environment. ```bash source .venv/bin/activate ``` -------------------------------- ### Login to Slack Bot with Token Source: https://docs.mau.fi/bridges/print.html Send the acquired Slack token and 'd' cookie to the bridge bot to initiate login. The 'd' cookie starts with 'xoxd-'. ```text login token ``` -------------------------------- ### Download Prebuilt Executable (CI) Source: https://docs.mau.fi/bridges/print.html Download prebuilt bridge artifacts directly from the CI pipeline. Choose the appropriate link based on your system architecture (e.g., linux/amd64, linux/arm64). ```bash https://mau.dev/mautrix/$bridge/-/jobs/artifacts/main/download?job=build%20amd64 ``` ```bash https://mau.dev/mautrix/$bridge/-/jobs/artifacts/main/download?job=build%20arm64 ``` ```bash https://mau.dev/mautrix/$bridge/-/jobs/artifacts/main/download?job=build%20arm ``` -------------------------------- ### Load v4l2loopback Module Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Loads the v4l2loopback kernel module, which creates a virtual video device (e.g., `/dev/video*`). This virtual device can then be used to feed custom video or screen content to the Android emulator's webcam. ```bash modprobe v4l2loopback ``` -------------------------------- ### Generate Appservice Registration File Source: https://docs.mau.fi/bridges/go/setup.html?bridge=signal Run this command to generate the application service registration file required by the homeserver. Flags can be used to specify custom locations for the config and registration files. ```bash ./mautrix-signal -g ``` -------------------------------- ### Caddy Configuration for Discord Media Proxy Source: https://docs.mau.fi/bridges/print.html Use this Caddy configuration to proxy Discord media downloads and thumbnails. Ensure you replace `discord-media.mau.dev` with your domain and adjust the `discord_` prefix as needed. This setup allows federated access to Discord media through your own server. ```caddy matrix.example.com { handle /_matrix/media/*/download/example.com/discord_ { header Access-Control-Allow-Origin * # Remove path prefix uri path_regexp ^/_matrix/media/.+/download/example\.com/discord_ / # The mxc patterns use | instead of /, so replace it first turning it into attachments/1234/5678/filename.png uri replace "%7C" / reverse_proxy { # reverse_proxy automatically includes the uri, so no {uri} at the end to https://cdn.discordapp.com # Caddy doesn't set the Host header automatically when reverse proxying # (because usually reverse proxies are local and don't care about Host headers) header_up Host cdn.discordapp.com } } # Do the same for thumbnails, but redirect to media.discordapp.net (which is Discord's thumbnailing server, and happens to use similar width/height params as Matrix) # Alternatively, you can point this at cdn.discordapp.com too. Clients shouldn't mind even if they get a bigger image than they asked for. handle /_matrix/media/*/thumbnail/example.com/discord_* { header Access-Control-Allow-Origin * uri path_regexp ^/_matrix/media/.+/thumbnail/example\.com/discord_ / uri replace "%7C" / reverse_proxy { to https://media.discordapp.net header_up Host media.discordapp.net } } handle /_matrix/* { reverse_proxy http://localhost:8008 } } ``` -------------------------------- ### Run Android Emulator Source: https://docs.mau.fi/bridges/go/whatsapp/android-vm-setup.html Launches the Android emulator for a specified AVD. Useful options include `-show-kernel` to display boot text, `-no-boot-anim` to disable boot animations, and `-avd AVD_NAME` to specify the device. ```bash ./emulator/emulator -show-kernel -no-boot-anim -avd AVD_NAME ``` -------------------------------- ### Run the mautrix-imessage bridge Source: https://docs.mau.fi/bridges/go/imessage/mac/setup.html Execute the compiled bridge. If it fails to initialize the iMessage connector, you may need to grant Full Disk Access to the terminal. ```bash ./mautrix-imessage ``` -------------------------------- ### Caddy Configuration for Discord Media Proxy Source: https://docs.mau.fi/bridges/go/discord/direct-media.html Configure Caddy to proxy Discord media downloads and thumbnails. This setup allows bridged media to work over federation by proxying requests instead of redirecting them. Ensure your domain and the Discord media hosts are correctly specified. ```caddy matrix.example.com { handle /_matrix/media/*/download/example.com/discord_* { header Access-Control-Allow-Origin * # Remove path prefix uri path_regexp ^/_matrix/media/.+/download/example\.com/discord_ / # The mxc patterns use | instead of /, so replace it first turning it into attachments/1234/5678/filename.png uri replace "%7C" / reverse_proxy { # reverse_proxy automatically includes the uri, so no {uri} at the end to https://cdn.discordapp.com # Caddy doesn't set the Host header automatically when reverse proxying # (because usually reverse proxies are local and don't care about Host headers) header_up Host cdn.discordapp.com } } # Do the same for thumbnails, but redirect to media.discordapp.net (which is Discord's thumbnailing server, and happens to use similar width/height params as Matrix) # Alternatively, you can point this at cdn.discordapp.com too. Clients shouldn't mind even if they get a bigger image than they asked for. handle /_matrix/media/*/thumbnail/example.com/discord_* { header Access-Control-Allow-Origin * uri path_regexp ^/_matrix/media/.+/thumbnail/example\.com/discord_ / uri replace "%7C" / reverse_proxy { to https://media.discordapp.net header_up Host media.discordapp.net } } handle /_matrix/* { reverse_proxy http://localhost:8008 } } ```