Skip to content

Instantly share code, notes, and snippets.

@mordr
Created September 11, 2024 17:36
Show Gist options
  • Save mordr/393e452a17feb928564e035a629a2ed5 to your computer and use it in GitHub Desktop.
Save mordr/393e452a17feb928564e035a629a2ed5 to your computer and use it in GitHub Desktop.
How to setup remote pbcopy?

Assuming pbcopy is installed on Mac.

Follow this blog to setup and launch a pbcopy.plist

After setting up OSX, update ~/.ssh/config to setup remote port forward RemoteForward 2224 127.0.0.1:2224

On remote host, add an executable shell script in path with

#!/bin/bash
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
cat $input | nc localhost 2224

When you are ssh'd in remote host, and you cat a file to pbcopy, the contents are sent over netcat through the ssh connection onto your OSX's pbcopy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment