David - Musings of an SRE

Copying in Tmux into your OSX Clipboard

One of the common gripes I have with using Tmux (even though its super awesome) is that its so difficult to copy text out of your tmux session into your system clipboard.

Recently I’ve came across a helpful snippet which would make it so much easier to do that in OSX. This doesn’t work on Linux unfortunately, but we’ll get to that in a bit!

Pre-requisite: Have homebrew.

In OSX:

$ brew install reattach-to-user-namespace

Modify your .tmux.conf to use copy-pipe.

#~/.tmux.conf

bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"