Skip to content
h-thavyPublic

About

Mirror and control your Android phone from your Mac — screen, touch, keyboard and sound. Tiny native app.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Mdroid logo

Mdroid

Mirror and control your Android phone from your Mac — screen, touch, keyboard and sound.
A tiny native app (~2 MB). No Electron, nothing installed on the phone.

Install

curl -fsSL https://raw.githubusercontent.com/h-thavy/mdroid/main/install.sh | bash

This installs Mdroid.app into Applications and sets up adb if you don't have it (via Homebrew, or Google's official platform-tools if Homebrew isn't installed).

Then plug in your phone. Mdroid walks you through the one-time setup (turning on USB debugging, with steps for your phone's brand) and starts mirroring by itself. After that, it also works over Wi-Fi.

Uninstall: curl -fsSL https://raw.githubusercontent.com/h-thavy/mdroid/main/install.sh | bash -s -- --uninstall

How it works

Mdroid pushes the open-source scrcpy server (v5.0.1, Apache-2.0, bundled in Resources/) to the phone over adb. It runs only while you mirror and nothing is installed. The Mac client is written from scratch in Swift/AppKit: hardware H.264 decoding (VideoToolbox), raw PCM audio through AVAudioEngine, and mouse/keyboard input sent back as touch and key events.

Requirements

  • macOS 14+ (Apple silicon or Intel)
  • Android 5+ for mirroring; Android 11+ for sound

Build from source

./build.sh            # → build/Mdroid.app and build/Mdroid.zip
./build.sh --install  # also copies it to /Applications
open "build/Mdroid.app"

With one phone connected it starts mirroring immediately; otherwise it shows the device list (⌘N). open -a "Mdroid" --args --serial <serial> mirrors a specific device.

Controls

Mac Phone
Click / drag Tap / swipe
Scroll / two-finger trackpad Scroll
Right-click, Esc, ⌘B Back
Middle-click, ⇧⌘H Home
⇧⌘S Recent apps
⌘↑ / ⌘↓ Volume up / down
⌘P Power
⇧⌘R Rotate
⇧⌘N Notifications
⇧⌘O Turn the phone's screen off/on while mirroring
Type Types on the phone (non-ASCII text, e.g. Khmer, is pasted through the clipboard)
Ctrl+A/C/V/X/Z Sent to the phone as-is
⌘V / ⌘C Paste Mac clipboard to phone / copy phone selection to Mac
⌘S Screenshot to Desktop
⌘R Reconnect
Drop an .apk Installs it
Drop any other file Copies it to the phone's Downloads

Wireless

With a cable (any Android): plug the phone in once. Mdroid sets up Wi-Fi by itself. Pull the cable and mirroring keeps going over Wi-Fi. Next time, just open Mdroid on the same Wi-Fi and it reconnects. (After the phone restarts, plug it in once more.)

Without a cable (Android 11+): click Connect with Wi-Fi… and scan the QR code from Settings › System › Developer options › Wireless debugging › Pair device with QR code. You pair once; after that Mdroid connects whenever Wireless debugging is on.

If the phone disconnects, Mdroid waits and resumes on its own as soon as the phone is back, on USB or Wi-Fi.

Bluetooth isn't supported: adb has no Bluetooth transport, and Bluetooth is too slow for live video.

Settings

Sound: the phone's audio plays on the Mac (the phone goes quiet while mirroring). Turn it off under Mdroid › Play Phone Audio on Mac.

Quality: Mdroid menu › Video Quality — Low (1024p/4 Mbps), Balanced (1600p/8 Mbps, default), High (native/16 Mbps).

Layout

File What
ADB.swift finds and runs adb, lists devices
MirrorSession.swift pushes/starts the server, adb forward tunnel, video + control sockets
AudioPlayer.swift low-latency PCM playback (ring buffer + AVAudioSourceNode)
VideoRenderer.swift Annex-B H.264 → CMSampleBuffer → AVSampleBufferDisplayLayer
Control.swift control-message encoders (scrcpy v5.0.1 wire format)
MirrorView.swift mouse/trackpad/keyboard → touch/scroll/key events
MirrorWindowController.swift window, toolbar, actions
LauncherWindowController.swift device list
Wireless.swift automatic Wi-Fi: remembers phones, USB → Wi-Fi handoff, reconnects
PairingController.swift QR-code pairing (Android 11+ Wireless debugging)

The server protocol is version-locked: when updating scrcpy-server, change serverVersion in MirrorSession.swift and SERVER_VERSION/SERVER_SHA256 in build.sh together.

Debug: MDROID_DEBUG=1 "build/Mdroid.app/Contents/MacOS/Mdroid" prints every control message.

Releasing

VERSION=X.Y.Z ./build.sh
gh release create vX.Y.Z build/Mdroid.zip --title "Mdroid X.Y.Z"

install.sh always fetches releases/latest/download/Mdroid.zip.

Credits

The on-device server is scrcpy-server by Genymobile and Romain Vimont, licensed under Apache-2.0 (see Resources/scrcpy-LICENSE). Mdroid is not affiliated with scrcpy or Genymobile.

About

Mirror and control your Android phone from your Mac — screen, touch, keyboard and sound. Tiny native app.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages