#!/bin/sh # Blue Text Relay installer: https://bluetextrelay.com/install.sh # Self-hosted MCP server for iMessage. Read this before you run it; it is short. # # curl -fsSL https://bluetextrelay.com/install.sh | sh # # What it does, and nothing else: # 1. Checks you're on macOS 14 or later. # 2. Downloads imx 1.0.0 (the Blue Text Relay CLI, universal binary) from downloads.bluetextrelay.com. # 3. Verifies its SHA-256 against the published SHA256SUMS. Stops if it doesn't match. # 4. Unpacks it to ~/.local/share/blue-text-relay/1.0.0 and links ~/.local/bin/imx. # No sudo. No telemetry. Nothing runs in the background until you ask for it (imx service install). # # Options (environment variables): # BTR_VERSION=1.0.0 install a specific version # BTR_BIN_DIR=/path where to put the imx link (default ~/.local/bin) # Uninstall: # imx service uninstall; rm -rf ~/.local/share/blue-text-relay ~/.local/bin/imx set -eu main() { version="${BTR_VERSION:-1.0.0}" base="https://downloads.bluetextrelay.com" tarball="imx-$version-macos.tar.gz" share="$HOME/.local/share/blue-text-relay/$version" bindir="${BTR_BIN_DIR:-$HOME/.local/bin}" say() { printf '\033[1;34m==>\033[0m %s\n' "$1"; } die() { printf '\033[1;31merror:\033[0m %s\n' "$1" >&2; exit 1; } [ "$(uname -s)" = "Darwin" ] || die "Blue Text Relay runs on macOS only (it reads the Messages database on a Mac)." major="$(sw_vers -productVersion | cut -d. -f1)" [ "$major" -ge 14 ] || die "macOS 14 or later is required (this Mac has $(sw_vers -productVersion))." command -v curl >/dev/null || die "curl is required." tmp="$(mktemp -d)" trap 'rm -rf "$tmp"' EXIT say "Downloading $tarball" curl -fsSL "$base/$tarball" -o "$tmp/$tarball" || die "download failed: $base/$tarball" curl -fsSL "$base/SHA256SUMS" -o "$tmp/SHA256SUMS" || die "couldn't fetch checksums: $base/SHA256SUMS" say "Verifying SHA-256" expected="$(grep " $tarball\$" "$tmp/SHA256SUMS" | awk '{print $1}')" [ -n "$expected" ] || die "$tarball is not listed in SHA256SUMS" actual="$(shasum -a 256 "$tmp/$tarball" | awk '{print $1}')" [ "$expected" = "$actual" ] || die "checksum mismatch (expected $expected, got $actual). Nothing was installed." say "Installing to $share" rm -rf "$share" mkdir -p "$share" "$bindir" tar -xzf "$tmp/$tarball" -C "$share" --strip-components 1 ln -sf "$share/imx" "$bindir/imx" printf '\n Installed imx %s -> %s\n\n' "$version" "$bindir/imx" case ":$PATH:" in *":$bindir:"*) ;; *) printf ' Add it to your PATH:\n echo '\''export PATH="%s:$PATH"'\'' >> ~/.zshrc && exec zsh\n\n' "$bindir" ;; esac printf ' Next:\n' printf ' 1. Give this binary Full Disk Access (macOS asks once; it is how any app reads Messages):\n' printf ' System Settings > Privacy & Security > Full Disk Access > + > %s\n' "$share/imx" printf ' open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"\n' printf ' 2. imx setup # pick threads, create an access key, choose Tailscale\n' printf ' 3. imx service install # optional: keep it running at login\n\n' printf ' Docs: https://bluetextrelay.com/docs Agents: https://bluetextrelay.com/llms.txt\n' } main "$@"