Install latest stable XQuartz.
Forward your X11 connection when SSHing to the box:
ssh -X remoteuser@remotehost
Alternatively you can configure this, globally or for an individual host, in your .ssh/config
with the ForwardX11
directive.
In your X11 preferences, open the "Pasteboard" tab and ensure "Enable syncing" and "Update Pasteboard when CLIPBOARD changes" are ticked.
On the remote *nix box, install XClip.
Copy STDIN
from your remote box to your local OS X box to XClip like so:
xclip -selection clipboard
You can paste text from your local OS X box to STDOUT
on your remote box like so:
xclip -o
You should be able to copy text from a Vim session on your remote box to your local OS X using the quoteplus ("+
) register.
For example, type "+y to copy the selection and "+p to paste the selection.
If you run Emacs with --no-window-system
it has no knowledge of X11, but it still has access to the shell. You can therefore interact with the X11 clipboard using XClip, for example using xclip.el.
You can use XClip with Tmux buffers, copying text:
tmux show-buffer | xclip -selection clipboard
Or pasting:
tmux set-buffer "$(xclip -o)"