Canopy copy-paste, and tmux, on Mac OS X

If you start a tmux session and run canopy from within tmux, copy paste will not work. This is due to the fact that tmux runs under a namespace heirarchy that makes system clipboard inaccessible. As such it also results in integration tests for copy paste to fail when executed from within tmux. The details for this problem are explained here:  https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard.  

To fix this, there are 2 steps:  

1. Install reattach-to-user-namespace.  

With homebrew:

brew install reattach-to-user-namespace

Without homebrew (from git):

git clone git@github.com:ChrisJohnsen/tmux-MacOSX-pasteboard.git
cd tmux-MacOSX-pasteboard/
make reattach-to-user-namespace

Then move the file to your PATH:

sudo mv reattach-to-user-namespace <YOUR_PATH>  

2. Update your tmux configuration file, typically .tmux.conf:

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

Replace zsh by the path or command of the shell you use.  After updating the tmux configuration, run:

tmux kill-server

and start your tmux session again. Now the copy paste command when canopy is run from within tmux will work fine. Note that this system clipboard functionality will be a problem for any other app that you will run from within tmux. So it's really not a canopy or any app specific issue.

-- thanks to Deepak Surti

Have more questions? Submit a request

Comments

Powered by Zendesk