Fix clipboard (text + images) in SSH and tmux sessions. Ctrl+V that actually works over SSH.
Built for developers who use AI coding agents (Claude Code, Codex, etc.) on remote servers.
When you SSH into a remote server:
- Ctrl+V with text works (terminal sends text bytes through SSH)
- Ctrl+V with an image does nothing (terminals can't send image bytes through SSH)
- In tmux, even text clipboard breaks without OSC 52 passthrough
Two components working together:
tcb-serverruns on your local machine — serves your clipboard (text + images) over a local port- SSH reverse tunnel connects that port back to the remote server
- tmux plugin —
Ctrl+V/prefix+vfetches clipboard through the tunnel
┌─ Local Machine ────────────────┐ ┌─ Remote Server ──────────────┐
│ │ │ │
│ tcb-server (:19988) │◄────│ SSH reverse tunnel │
│ clipboard has text? → send │ │ ↓ │
│ clipboard has image? → send │ │ Ctrl+V / prefix+v: │
│ │ │ text → paste into pane │
│ │ │ image → save file, type │
│ │ │ path into pane │
└────────────────────────────────┘ └──────────────────────────────┘
macOS (Warp, iTerm2, Ghostty, Kitty, Alacritty)
mkdir -p ~/.local/bin
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb -o ~/.local/bin/tcb && chmod +x ~/.local/bin/tcb
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb-server -o ~/.local/bin/tcb-server && chmod +x ~/.local/bin/tcb-serverMake sure ~/.local/bin is in your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrctcb install user@your-serverThis does three things:
- Adds
RemoteForward 19988 localhost:19988to your~/.ssh/config - Installs a LaunchAgent so
tcb-serverstarts automatically on login - Starts
tcb-serverimmediately
After this, just ssh user@your-server normally — the clipboard tunnel is always there.
SSH into your server and add to ~/.tmux.conf before tmux-yank:
set -g @plugin 'drewstone/clipboard-bridge'
set -g @plugin 'tmux-plugins/tmux-yank'Then press prefix + I to install via TPM.
- Python 3 (pre-installed on macOS)
osascript(built-in) — orbrew install pngpastefor faster image extraction- SSH key auth to your server (
ssh-copy-id user@server)
tcb uninstallLinux (X11 or Wayland)
mkdir -p ~/.local/bin
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb -o ~/.local/bin/tcb && chmod +x ~/.local/bin/tcb
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb-server -o ~/.local/bin/tcb-server && chmod +x ~/.local/bin/tcb-server# X11
sudo apt install xclip
# Wayland
sudo apt install wl-clipboardAdd to ~/.ssh/config:
Host your-server
HostName your-server.example.com
User your-username
RemoteForward 19988 localhost:19988
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/tcb-server.service <<EOF
[Unit]
Description=clipboard-bridge server
After=graphical-session.target
[Service]
ExecStart=/usr/bin/python3 %h/.local/bin/tcb-server
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now tcb-serverAdd to ~/.tmux.conf before tmux-yank:
set -g @plugin 'drewstone/clipboard-bridge'
set -g @plugin 'tmux-plugins/tmux-yank'Press prefix + I to install.
- Python 3
xclip(X11) orwl-clipboard(Wayland)- SSH key auth
The tcb-server clipboard detection currently uses osascript (macOS). On Linux, you'll need to modify tcb-server to use xclip / wl-paste instead. A cross-platform version is planned — contributions welcome.
Windows (Windows Terminal, WSL)
mkdir -p ~/.local/bin
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb -o ~/.local/bin/tcb && chmod +x ~/.local/bin/tcb
curl -fsSL https://raw.githubusercontent.com/drewstone/clipboard-bridge/main/local/tcb-server -o ~/.local/bin/tcb-server && chmod +x ~/.local/bin/tcb-serverAdd to ~/.ssh/config inside WSL:
Host your-server
HostName your-server.example.com
User your-username
RemoteForward 19988 localhost:19988
tcb server &Or add to your .bashrc:
# Auto-start tcb-server
if ! nc -z localhost 19988 2>/dev/null; then
nohup python3 ~/.local/bin/tcb-server > /dev/null 2>&1 &
fiAdd to ~/.tmux.conf before tmux-yank:
set -g @plugin 'drewstone/clipboard-bridge'
set -g @plugin 'tmux-plugins/tmux-yank'Press prefix + I to install.
- WSL 2
- Python 3
- Windows Terminal (supports OSC 52)
- SSH key auth
The tcb-server clipboard detection currently uses osascript (macOS). On WSL, you'll need to modify tcb-server to use powershell.exe Get-Clipboard or win32clipboard. A cross-platform version is planned — contributions welcome.
Once installed, Ctrl+V works in remote tmux sessions for both text and images:
Ctrl+V— pastes text or image from your local clipboardprefix + v— same thing (prefixed version)prefix + P— insert latest image pathprefix + M-p— fzf picker for all uploaded images- Mouse drag — select + copy to local clipboard (highlight persists)
- Double-click — select word
- Triple-click — select line
- Screenshot something on your local machine
- Press
Ctrl+Vin the remote tmux pane running Claude Code - Image path appears (e.g.,
~/.tmux/clipboard/images/20260301T143022.png) - Claude Code reads the image file
Two mechanisms for maximum compatibility:
- OSC 52 — tmux sends clipboard data via escape sequences through SSH to your terminal (handles mouse selection and
yyank automatically) - Reverse tunnel —
Ctrl+Vfetches text from your local clipboard through the tunnel and pastes it
- You copy/screenshot an image locally
- Press
Ctrl+V(orprefix+v) in the remote tmux session - The plugin connects to
tcb-servervia the reverse tunnel - Server extracts the image from your clipboard, sends it as base64
- Remote script decodes it, saves to
~/.tmux/clipboard/images/, types the path
tcb install <user@host> One-time setup (SSH config + auto-start server)
tcb uninstall Remove LaunchAgent / service
tcb server [--port N] Start clipboard server (default: 19988)
tcb ssh <user@host> [--port N] SSH with reverse tunnel (auto-starts server)
tcb push <user@host> [--type] One-shot: push clipboard image via SCP
tcb clean <user@host> [N] Remove old images, keep last N (default: 50)
tcb setup Show full setup guide
| Binding | Action |
|---|---|
Ctrl+V |
Smart paste — text or image from local clipboard |
prefix + v |
Same as Ctrl+V (prefixed version) |
prefix + P |
Insert latest image path |
prefix + M-p |
fzf picker for uploaded images |
| Mouse drag | Select + copy (highlight persists) |
| Double-click | Select word |
| Triple-click | Select line |
# Tmux options (all optional, showing defaults)
set -g @tcb_server_port "19988" # Reverse tunnel port
set -g @tcb_paste_key "v" # prefix + ? for smart paste
set -g @tcb_image_latest_key "P" # prefix + ? for latest image
set -g @tcb_image_pick_key "M-p" # prefix + ? for fzf picker
set -g @tcb_passthrough "on" # OSC 52 passthrough mode
set -g @tcb_yank_action "copy-pipe-no-clear" # Selection persistence
set -g @tcb_image_dir "$HOME/.tmux/clipboard/images"
set -g @tcb_watch "on" # Auto-sync clipboard watcher
set -g @tcb_watch_interval "3" # Watcher poll interval (seconds)When @tcb_watch is on (default), a background process polls tcb-server every few seconds. When it detects a new image on your clipboard, it automatically saves it to the image directory and updates the latest.png symlink. No keypress needed — images are always available at ~/.tmux/clipboard/images/latest.png.
This is especially useful with Claude Code and Codex, which intercept Ctrl+V/Cmd+V before tmux can handle it. Just copy/screenshot on your Mac and reference ~/.tmux/clipboard/images/latest.png in the chat.
Add this to your AI agent's memory/instructions (e.g. CLAUDE.md, .openclaw, .codex):
When the user says "check the latest screenshot", "look at $IMG", or similar —
read the file at: /home/drew/.tmux/clipboard/images/latest.png
This is automatically synced from the user's macOS clipboard via clipboard-bridge.
This way you can just say "look at the latest screenshot" and the agent knows where to find it.
- Remote: tmux 3.3+ (for
allow-passthrough), Python 3 (for JSON parsing) - Local: Python 3, platform clipboard tools (see install sections above)
- Terminal: Any terminal supporting OSC 52 — Warp, iTerm2, Ghostty, Kitty, Alacritty, Windows Terminal
MIT