For: Apple Mac, MacBook Air, MacBook Pro, Mac mini, iMac, Mac Studio, Mac Pro
Keywords: macOS, Screen Sharing, Input Method, IME, VNC, Hammerspoon
Sync input method between local and remote Mac when using Screen Sharing.
Newer macOS Screen Sharing has a built-in "Sync Keyboard Language" feature.
Please check: Screen Sharing App → Settings, see if this option exists.
- ✅ Option exists → Just enable it, no need for this tool
- ❌ Option not found → Your macOS version is older, please use this tool
This tool is for:
- Local or remote Mac running older macOS without built-in sync feature
- Backup solution when built-in feature has issues
When using macOS built-in Screen Sharing, input method behaves like this:
| Local Input | Remote Input | Actual Output |
|---|---|---|
| English | Zhuyin | English ❌ |
| Zhuyin | English | Zhuyin ❌ |
| Zhuyin | Zhuyin | Zhuyin ✅ |
This happens because Screen Sharing sends "processed characters" instead of raw keystrokes.
- ✅ Exact Sync — macism mode directly specifies input method, never misaligned
- ✅ Per-host Settings — Choose toggle or macism mode for each host
- ✅ SSH ControlMaster Acceleration — Only 10-50ms latency
- ✅ Focus-aware — Only triggers when Screen Sharing window is focused
- ✅ Auto-detect New Hosts — Configure on first connection, remembered afterwards
- ✅ Menubar Control — Pause/resume, add/edit/delete hosts
| Mode | Icon | Description | Remote Requirement |
|---|---|---|---|
| Toggle | 🔄 | Send Ctrl+Space to toggle | SSH + Accessibility permission |
| macism | 🎯 | Directly specify input method ID | SSH + macism (requires macOS 10.15+) |
Note: macism requires macOS 10.15 (Catalina) or later. Use Toggle mode for older versions.
Local (Control Mac):
- macOS 10.15 or later
- Homebrew
- Hammerspoon
Remote (Controlled Mac):
- macOS 10.14 or later
- SSH (Remote Login) enabled
- Accessibility permission granted
System Preferences → Sharing → Check "Remote Login"
Note the connection info, e.g., ssh user@192.168.1.100
SSH-executed AppleScript needs accessibility permission:
System Preferences → Security & Privacy → Privacy → Accessibility
- Click 🔒 to unlock
- Click "+" and add
/usr/bin/osascript- Press
Cmd+Shift+Gand enter/usr/bin/ - Select
osascript
- Press
Or add "Terminal" app (/Applications/Utilities/Terminal.app).
Run this on the remote Mac:
osascript -e 'tell application "System Events" to key code 49 using control down'If input method switches, permission is set correctly.
brew install --cask hammerspoonmkdir -p ~/.hammerspoon
curl -o ~/.hammerspoon/init.lua https://raw.githubusercontent.com/taigadit/mac-screen-sharing-input-sync/main/init.lua- Open Hammerspoon
- Go to "System Settings → Privacy & Security → Accessibility"
- Allow Hammerspoon
# Generate key (if not already done)
ssh-keygen -t ed25519
# Copy to remote (enter password once)
ssh-copy-id user@remote-IPVerify passwordless login:
ssh user@remote-IP "echo ok"If it shows ok without password prompt, it's working.
ssh user@remote-IP "osascript -e 'tell application \"System Events\" to key code 49 using control down'"If remote input method switches, everything is set up correctly!
mkdir -p ~/.ssh/socketsEdit ~/.ssh/config, add:
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
Set permissions:
chmod 600 ~/.ssh/configThis reduces latency from 200-500ms to 10-50ms.
Click Hammerspoon icon (🔨) in menubar → Reload Config
If remote is macOS 10.15+ and you want exact sync:
ssh user@remote-IP
brew tap laishulu/homebrew
brew install macismNote: macOS 10.14 (Mojave) cannot install macism. Use Toggle mode instead.
- Open Screen Sharing and connect to remote Mac
- Click into the Screen Sharing window (make it focused)
- Switch local input method
- Remote will sync automatically!
First time will show a dialog:
- Enter SSH connection info (e.g.,
user@192.168.1.100) - Select sync mode (Toggle or macism)
- Settings are saved automatically
Toggle mode uses Ctrl+Space, which only toggles between inputs.
Important: Manually align both sides first (both English or both Zhuyin), then they'll stay synced.
⌨️ icon appears in menubar. Click to:
- ✅ View sync status
- ⏸️ Pause/resume sync
- 📋 Manage host list
- ➕ Add host
- 🔄/🎯 Switch sync mode
-
Check SSH passwordless login:
ssh user@remote-IP "echo ok" -
Check accessibility permission on remote:
ssh user@remote-IP "osascript -e 'tell application \"System Events\" to key code 49 using control down'" -
Make sure Screen Sharing window is focused
- macism mode: Directly specifies input method, won't misalign
- Toggle mode: Manually align first, then they'll stay synced
macism requires macOS 10.15 (Catalina) or later. Use Toggle mode for Mojave (10.14).
Setup SSH ControlMaster (see installation steps) to reduce latency from 200-500ms to 10-50ms.
MIT License
Developed by Dajiade Co., Ltd. (taigadit)