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.