3

I want to copy/paste in my tmux sessions like I was able to with El Capitan. I just installed MacOS Sierra and I no longer have this functionality. I didn't realize how often I utilized this capability until I lost it yesterday.

  • MacOS Sierra Beta 5
  • Tmux 2.2
  • iterm2 build 3.0.7
  • reattach-to-user-namespace v2.5

Things I have done

  • I tried the original tmux config settings in this article using reattach-to-user-namespace.
  • I have uninstalled reattach-to-user-namespace and reinstalled with brew.
  • I know that beginning in El Capitan, the above wrapper was no longer needed to use pbcopy/pbpaste. It was removed from my .tmux.conf file with the release of El Capitan.

This is the last hiccup I need to fix after loading up Sierra on this macbook. I'm not sure how to debug this to figure what is not working correctly. Any help in either direction, with debugging aid or a solution, would be highly appreciated.

3

Bugger - I found a setting in iterm2 I was missing. What I noticed is that pbpaste was indeed working as expected, I just could not select text in a tmux session and have pbcopy work as expected.

This led me to take a very hard look at my iterm2 preferences. Enabling this setting worked, Applications in terminal may access clipboard.

enter image description here

I am also including my .tmux.conf section regarding pbcopy/pbpaste for others as there are not any recent resources on this topic:

# copy-paste integration
set-option -g default-command "login-shell"

# use vim key bindings in copy mode
setw -g mode-keys vi

# use 'v' to begin selection like in vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "pbcopy"

# update default bindings of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "pbcopy"

# bind ']' to use pbpaste
bind ] run "pbpaste | tmux load-buffer - && tmux paste-buffer"

Notice I use login-shell, be sure your preferred shell is in /etc/shells and you have set it as your default shell.

chsh -s /usr/local/bin/bash
1

For me, checking that box did not do the trick - I had to add tmux-MacOSX-pasteboard again, as stated here:

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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