The following code used to work in my .tmux.conf:

# Mac OS X:
bind-key -n -t emacs-copy M-w copy-pipe "reattach-to-user-namespace pbcopy"

# Move tmux copy buffer into x clipboard
unbind-key M-w
bind-key -n M-w run "tmux save-buffer - | xclip -i -selection clipboard" \; display-message 'Copying to clipboard'

It stopped working just recently, so I can't copy text anymore from tmux to elsewhere. I am guessing this is the result of upgrading tmux or reattach-to-user-namespace.

I now get the following error:

invalid or unknown command: bind-key -n -t emacs-copy M-w copy-pipe 
"reattach-to-user-namespace pbcopy"

Here are the versions I am using (from brew).



What may have changed, and how can I go about restoring my ability to copy from tmux to the system?

  • What port or package system are you using? With MacPorts tmux and the pasteboard software can both be installed via sudo port install tmux tmux-pasteboard – thrig May 2 '17 at 22:15
  • Thanks @thrig I'm using brew. I updated the OP. – Amelio Vazquez-Reina May 2 '17 at 22:16

Try the following instead:

bind-key -T copy-mode M-w send-keys -X copy-pipe 'reattach-to-user-namespace pbcopy'

Note that tmux recently changed key tables:

  • Key tables have undergone major changes. Mode key tables are no longer separate from the main key tables. All mode key tables have been removed, together with the -t flag to bind-key and unbind-key.

    The emacs-edit, vi-edit, emacs-choose and vi-choose tables have been replaced by fixed key bindings in the command prompt and choose modes. The mode-keys and status-keys options remain.

    The emacs-copy and vi-copy tables have been replaced by the copy-mode and copy-mode-vi tables. Commands are sent using the -X and -N flags to send-keys. So the following:

    bind -temacs-copy C-Up scroll-up bind -temacs-copy -R5 WheelUpPane scroll-up


    bind -Tcopy-mode C-Up send -X scroll-up bind -Tcopy-mode WheelUpPane send -N5 -X scroll-up

    This changes allows the full command parser (including command sequences) and command set to be used - for example, the normal command prompt with editing and history is now used for searching, jumping, and so on instead of a custom one. The default C-r binding is now:

    bind -Tcopy-mode C-r command-prompt -p'search up' "send -X search-backward '%%'"

    There are also some new commmands available with send -X, such as

  • Hi Amelio! Tried your solution but without success. I'm using tmux 2.5 on MacOS with reattach-to-user-namespace installed. Both installed through brew. – David Dias Aug 15 '17 at 7:14
  • Also, my goal is to get vi bindings and not emacs – David Dias Aug 15 '17 at 7:17

As Amelio mentioned in the other answer, tmux in version 2.4 had undergone major, backwards incompatibile changes when it comes to handling keyboard shortcut maps.

The way how I got copying to work with vi keys and version 2.6 is:

bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
bind-key -T copy-mode-vi V send-keys -X rectangle-toggle
bind-key -T copy-mode-vi Y send-keys -X copy-end-of-line

You should be able to use similar syntax to bind the right commands for yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.