// Richard Hart / Hates_

OSX Copy/Paste in tmux

computing
Share

One of the big things that took me a while to get right in tmux was copy/pasting. The gripes of trying to get it to work were enough to nearly make me forget using it all together.

Here’s what you need to know.

Install reattach-to-user-namespace

brew install reattach-to-user-namespace

and then in your .tmux.conf

set-option -g default-command "reattach-to-user-namespace -l zsh"

Assign a binding to copy the current buffer

In your .tmux.conf set a binding to copy the buffer

bind-key C-c run-shell "tmux save-buffer - | reattach-to-user-namespace pbcopy"

Now it actually took me ages to work out how to use this properly. Once you have created the buffer, either through selecting it with the mouse or by using PREFIX – [ and SPACE/ENTER, press PREFIX – C-c and it will be copied to your system clipboard.

Use the option key

If you hold down the option key while in the terminal, you can create a selection just as if you’re weren’t in tmux.


  • ds1982

    Thanks for the Hint with the option key! Saved my day!