Use Case

Copy Text from an SSH Server to Your Local Clipboard

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 AllowAgentForwarding and 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 laptop

The 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:

Terminal window
# On the remote
some-command | cinch push
# On your laptop
cinch pull

Common Patterns

Copy a file’s contents:

Terminal window
cat /etc/nginx/nginx.conf | cinch push

Copy command output:

Terminal window
docker logs my-container 2>&1 | tail -50 | cinch push

Copy your SSH public key:

Terminal window
cat ~/.ssh/id_ed25519.pub | cinch push
# Then cinch pull on your laptop and paste into GitHub

Copy a one-liner from history:

Terminal window
history | grep "kubectl" | tail -5 | cinch push

Works Everywhere SSH Does

Because Cinch uses HTTPS, it works in all the places OSC 52 doesn’t:

  • Inside tmux and GNU screen
  • In docker exec sessions
  • 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:

Terminal window
docker run -p 8080:8080 ghcr.io/jinmugo/cinch-relay:latest

Then point Cinch at it:

Terminal window
cinch auth login --relay https://your-relay.example.com

See the relay self-hosting guide for full instructions.

  1. 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. 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. 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. 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.