Skip to content

arjlai221/mac-relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenLink

An open-source iMessage bridge for Android — relay through your Mac.

OpenLink lets you send and receive iMessages from your Android phone by using a Mac as an always-on relay. No jailbreak, no Apple protocol reverse engineering — just AppleScript and the macOS Messages database.

How It Works

graph LR
    A[Android Client] <-->|WebSocket + REST| B[Mac Relay Server]
    B <-->|AppleScript + chat.db| C[macOS Messages.app]
    C <-->|iMessage Protocol| D[Apple Servers]
Loading
  1. Your Mac runs the OpenLink relay server (a Python/FastAPI process).
  2. The relay sends iMessages via AppleScript and reads incoming messages from the macOS Messages SQLite database (chat.db).
  3. Your Android phone connects to the relay over your network (LAN, Tailscale, or Cloudflare Tunnel) and provides a full messaging UI.

This is a single-user, personal-use system. The Mac relay IS the server — there's no separate backend.

Prerequisites

  • Mac running macOS 12+ (Monterey or later), signed into iMessage with your Apple ID
  • Python 3.11+ on the Mac
  • Flutter 3.x (for building the Android client)
  • Full Disk Access granted to Terminal/your shell (so the relay can read chat.db)

Quick Start

1. Mac Relay

cd relay
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m relay.main

On first run, the relay prints an auth token. Copy it — you'll need it to pair your phone.

2. Android Client

cd client
flutter pub get
flutter run          # connected Android device or emulator
# Or build a release APK:
flutter build apk --release

Open the app, enter your relay's URL (e.g. http://192.168.1.50:8765) and the auth token. Tap Connect.

3. Remote Access (optional)

To use OpenLink outside your home network:

  • Tailscale (recommended): Install on both devices. Use the Mac's Tailscale IP.
  • Cloudflare Tunnel: cloudflared tunnel --url http://localhost:8765

See relay/tunnel.py for details.

Project Structure

openlink/
├── relay/              # Mac relay server (Python/FastAPI)
│   ├── bridge/         # AppleScript bridge + message watcher
│   ├── server/         # FastAPI app + auth
│   ├── db/             # Database layer (chat.db reader + openlink.db)
│   ├── tests/          # pytest test suite
│   ├── config.py       # Configuration
│   ├── main.py         # Entry point
│   └── requirements.txt
├── client/             # Android app (Flutter)
│   ├── lib/
│   │   ├── models/     # Message, Conversation
│   │   ├── services/   # API, WebSocket, notifications
│   │   ├── providers/  # State management
│   │   ├── screens/    # Setup, ConversationList, Chat, Settings
│   │   └── widgets/    # MessageBubble, etc.
│   └── pubspec.yaml
└── docs/               # Setup guides and architecture docs

Limitations & Risks

  • Requires a Mac running 24/7. A Mac Mini or always-on MacBook works best.
  • Apple could break compatibility at any time. AppleScript and the chat.db schema are undocumented and may change with macOS updates.
  • Use a dedicated Apple ID if you're concerned about account risk. Apple's ToS are ambiguous about programmatic access to Messages.
  • Personal use only. This is not designed for multi-user or commercial use.
  • No end-to-end encryption between the relay and Android client. Use TLS (via Tailscale or Cloudflare Tunnel) to secure the connection.

FAQ

Why no FaceTime? OpenLink is a text messaging bridge. FaceTime is a separate protocol (audio/video calling) that is entirely out of scope. The relay only interacts with the Messages framework.

Is this safe to use? We use only official macOS interfaces (AppleScript, SQLite). We do not reverse engineer Apple protocols, intercept network traffic, or modify system files. That said, Apple has not blessed this use case — use at your own discretion.

Does it work with SMS too? If your Mac is set up for SMS relay (iPhone + Mac linked), those messages appear in chat.db and will work through OpenLink.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors