Control your Mac from any device on your local network — keyboard, mouse, media, screen streaming and more.
- Requirements
- macOS Permissions
- Install Dependencies
- HTTPS Setup
- Trust Certificate on iPhone
- Run the Server
- Connect from iPhone
- File Structure
- Troubleshooting
- macOS (Apple Silicon or Intel)
- Python 3.10+
- Homebrew
- iPhone / iPad on the same WiFi network
These must be granted before running the server — otherwise key presses, mouse control and screen capture won't work.
- System Settings → Privacy & Security → Accessibility
- Click + and add Terminal (or your Python binary e.g.
/usr/local/bin/python3) - Toggle it ON
- System Settings → Privacy & Security → Screen Recording
- Add Terminal or Python → Toggle ON
💡 On first run macOS may auto-prompt you — click "Open System Settings" and enable from there.
pip3 install -r requirements.txt
brew install cliclickThe server runs over HTTPS so that browser APIs work correctly on iPhone. The server now uses your Mac's stable Bonjour hostname instead of depending on the changing WiFi IP.
Your Mac's local URL is:
https://pratiks-MacBook.local:5001
The server automatically reads the macOS LocalHostName, creates certs/ca.pem if needed, and signs certs/cert.pem for:
localhostpratiks-MacBook.local- the current LAN IP as a fallback
Run the server once to create or refresh the certificates:
python3 server.pyIf your WiFi IP changes later, just restart the server. You do not need to repeat the iPhone certificate trust flow as long as certs/ca.pem is the same.
To see or change the .local name on macOS:
scutil --get LocalHostNameOr use System Settings → General → Sharing → Edit → Local hostname.
| File | Purpose | Share? |
|---|---|---|
certs/ca.pem |
Root CA — AirDrop this to iPhone once | ✅ Safe to share |
certs/ca-key.pem |
CA private key — keep this secret | ❌ Never share |
certs/cert.pem |
Server certificate — used at runtime | ❌ Keep on Mac |
certs/key.pem |
Server private key — used at runtime | ❌ Never share |
This is a one-time setup per device as long as certs/ca.pem is preserved.
Open Finder to your project folder:
open /path/to/remote/certsAirDrop ca.pem to your iPhone (not ca-key.pem).
Settings → General → VPN & Device Management → tap the downloaded profile → tap Install → enter passcode → tap Install again on the warning screen.
Settings → General → About → Certificate Trust Settings → find Remote Mac Controller → toggle ON → tap Continue.
Without this step Safari will still reject the certificate even after installation.
python3 server.pyYou'll see:
==========================================================
Remote Mac Controller
==========================================================
URL: https://pratiks-MacBook.local:5001
Fallback URL: https://192.168.1.4:5001
Clipboard: copied
Press Ctrl+C to stop
==========================================================
The .local URL is automatically copied to your clipboard. Use the fallback IP only if .local does not resolve on the current network.
- Make sure iPhone and Mac are on the same WiFi (or iPhone hotspot)
- Open Safari on iPhone
- Go to
https://pratiks-MacBook.local:5001— type the fullhttps://prefix - You should see "Connected to Mac" in green
💡 Add to Home Screen — tap Share → "Add to Home Screen" for a fullscreen PWA experience with no browser chrome.
remote/
├── server.py ← Flask + SocketIO backend
├── requirements.txt ← Python dependencies
├── README.md ← This file
├── certs/
│ ├── ca.pem ← Root CA (AirDrop to iPhone)
│ ├── ca-key.pem ← CA private key (never share)
│ ├── cert.pem ← Server certificate
│ └── key.pem ← Server private key
├── templates/
│ ├── index.html ← Main iPhone controller UI
│ ├── apps.html ← App launcher UI
│ ├── remote_preview.html ← Remote with screen preview
│ └── remote_preview_trackpad.html ← Remote with trackpad
├── media/ ← App icons and assets
└── logs/
└── remote.log ← Rotating server logs
| Problem | Fix |
|---|---|
| Keys not working | Grant Accessibility permission (see macOS Permissions) |
| Screen recording not working | Grant Screen Recording permission |
| iPhone shows certificate warning | Complete the Trust Certificate steps above — especially Step 3 |
.local address does not open |
Make sure both devices are on the same WiFi/subnet. Guest, hotel, or office WiFi can block Bonjour/mDNS. Try the printed fallback IP. |
Safari drops https:// and fails |
You missed the Certificate Trust Settings toggle (Step 3 above) |
| Can't connect from iPhone | Ensure same WiFi; always type full https:// prefix |
| Port already in use | Change SERVER_PORT in server.py |
osascript errors |
Re-grant Accessibility, restart Terminal |
| IP changed after reconnect | Use https://pratiks-MacBook.local:5001; the server refreshes the fallback IP cert automatically on restart. |
| Mouse/click not working | Install cliclick via brew install cliclick |