Tutorial

Using Cinch with tmux: Clipboard Sync That Actually Works

The tmux Clipboard Problem

If you’ve tried to copy text from a tmux session to your local clipboard, you’ve probably run into one of these:

  • OSC 52 escape sequences get swallowed by tmux and never reach your terminal
  • xclip / xdotool solutions require a display and break over SSH
  • The tmux allow-passthrough workaround is fragile and version-dependent

Cinch sidesteps all of this. It communicates over HTTPS — completely independent of the terminal, tmux, or SSH — so it works the same whether you’re inside tmux or not.

Prerequisites

  • Cinch installed and signed in on the remote machine — it runs cinch send, so it needs your encryption key. Either cinch auth login there, or cinch fleet add it from your laptop (curl -fsSL https://cinchcli.com/install.sh | sh to install).
  • Cinch installed locally and authenticated (cinch auth login) — it runs cinch pull.

Basic Usage Inside tmux

Nothing special is required. Inside any tmux pane, pipe output to cinch send:

Terminal window
cat some-file.txt | cinch send

Then on your local machine:

Terminal window
cinch pull
# content is now in your system clipboard

That’s it. No tmux plugin, no escape sequence hacks.

Copy tmux Pane Output

To copy the visible contents of the current pane, use tmux capture-pane:

Terminal window
tmux capture-pane -p | cinch send

Or add it as a tmux keybinding. In your ~/.tmux.conf:

bind-key y run-shell "tmux capture-pane -p | cinch send"

Then prefix + y sends the current pane output to your fleet.

Copy tmux Selection

In copy mode (prefix + [), after making a selection, you can pipe it through cinch. Add this to ~/.tmux.conf:

bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "cinch send"
bind-key -T copy-mode Enter send-keys -X copy-pipe-and-cancel "cinch send"

Now pressing y (vi mode) or Enter (emacs mode) in copy mode sends the selection to your relay and cancels copy mode.

With tmux Plugin Manager (TPM)

If you use TPM, there’s no dedicated Cinch plugin yet — but the keybinding approach above works alongside tmux-yank and other clipboard plugins. Cinch and tmux-yank don’t conflict; you can have both bound to different keys.

Why This Works When OSC 52 Doesn’t

OSC 52 sends an escape sequence through the terminal stream: remote shell → SSH → terminal emulator → clipboard. tmux sits in the middle of this stream and, by default, strips or ignores escape sequences it doesn’t recognize.

Cinch skips the terminal stream entirely:

remote shell → cinch send → HTTPS → relay → cinch pull → local clipboard

tmux has no opportunity to interfere because Cinch never touches the terminal protocol.

Automating with Scripts

Because cinch send is just a command, you can use it in any script running inside tmux:

#!/bin/bash
# Run a build and send the result summary to your fleet
npm run build 2>&1 | tail -20 | cinch send
echo "Build output sent to your fleet"

Troubleshooting

cinch send hangs: Check that the relay is reachable from the remote machine. Run curl https://cinchcli.com/health (or your relay URL) to verify connectivity.

Content doesn’t appear on cinch pull: Make sure both machines are authenticated to the same relay and the same account. Run cinch auth status on both machines to verify.

Want to keep clipboard history? The Cinch desktop app shows a history of recent clips pulled from the relay. See the desktop app docs for setup.