Why pbcopy and xclip Don’t Work Over SSH
When you SSH into a remote server, you’re running commands in a shell on that machine. The shell has no access to your local machine’s clipboard — pbcopy writes to macOS’s pasteboard, which doesn’t exist on the remote server. xclip writes to the X11 clipboard, which requires a display connection that SSH sessions don’t forward by default.
The common workarounds all have tradeoffs:
- OSC 52 — works in simple SSH sessions but breaks inside tmux, Docker, and CI environments
- SSH port forwarding — requires
AllowAgentForwardingand per-machine SSH config changes - Manual copy — works, but you’re doing it hundreds of times a day
Cinch uses a different approach: a relay server over HTTPS that any machine can reach.
How It Works
remote server → cinch push → relay (HTTPS) → cinch pull → your laptopThe remote pushes content to a relay server over HTTPS. Your local machine pulls from the same relay. No SSH tunnel, no special configuration.
Setup
The steps above walk through the full setup. If you already have Cinch installed on both machines, it’s just two commands:
# On the remotesome-command | cinch push
# On your laptopcinch pullCommon Patterns
Copy a file’s contents:
cat /etc/nginx/nginx.conf | cinch pushCopy command output:
docker logs my-container 2>&1 | tail -50 | cinch pushCopy your SSH public key:
cat ~/.ssh/id_ed25519.pub | cinch push# Then cinch pull on your laptop and paste into GitHubCopy a one-liner from history:
history | grep "kubectl" | tail -5 | cinch pushWorks Everywhere SSH Does
Because Cinch uses HTTPS, it works in all the places OSC 52 doesn’t:
- Inside tmux and GNU screen
- In
docker execsessions - In VS Code Remote SSH
- Across nested SSH hops
- In non-interactive shells and scripts
Self-Hosting
If you’d rather not use the default relay, run your own:
docker run -p 8080:8080 ghcr.io/jinmugo/cinch-relay:latestThen point Cinch at it:
cinch auth login --relay https://your-relay.example.comSee the relay self-hosting guide for full instructions.
- 1 Install Cinch on the remote server
Download and install the cinch binary on your remote machine.
curl -fsSL https://cinchcli.com/install.sh | sh - 2 Authenticate with your relay
Run cinch auth login on the remote. Use the default hosted relay or point to your self-hosted one.
cinch auth login - 3 Push clipboard content from the remote
Pipe any command output into cinch push. The content is sent to the relay instantly.
cat ~/.ssh/id_ed25519.pub | cinch push - 4 Pull on your local machine
On your laptop or any other machine, run cinch pull. The content lands in your system clipboard.
cinch pull
Frequently Asked Questions
- Why doesn't pbcopy work over SSH?
- pbcopy writes to the macOS pasteboard, which only exists on the local machine. When you run pbcopy inside an SSH session, there is no pasteboard to write to — the command either errors or silently does nothing.
- Does Cinch require any SSH config changes?
- No. Cinch communicates over HTTPS, not through the SSH connection. No AllowAgentForwarding, no X11Forwarding, no special SSH flags needed.