Synchronize pasteboard between remote tmux session and local Mac OS pasteboard

So, when you ssh into the server, you can use reverse tunneling so that you can talk back to your OSX machine to send it commands do pbcopy.

ssh -R 1234:localhost:22 remoteServer

Replace 1234 with any open port the remote server. Then on the remote server, you can then run:

tmux save-buffer - | ssh -p 1234 localhost pbcopy

That should connect back to OSX and send the contents of your tmux copy buffer to it. You may want to use ssh keys to prevent typing your password to your OSX machine.

If that works for, you can then create your tmux keybindings.

bind C-c run "tmux save-buffer - | ssh -p 1234 localhost pbcopy"

I should note, for this to work, you will need to turn on Remote Sharing in OSX.

Secondary Option:

Since you're using OSX, if you're also using iTerm2, you might consider installing http://code.google.com/p/iterm2/downloads/detail?name=tmux-for-iTerm2-20120203.tar.gz&can=2&q= on your servers.

It's basically a custom tmux what supports the "-C" flag. This flag hands over windows, and panes and all their splitting to iTerm2.


I think that this problem was solved in a better way:

http://seancoates.com/blogs/remote-pbcopy