I have discovered that tmux breaks pbpaste, pbcopy and launchctl.

Is there a good way to make it play nice with these tools?


Okay, I found a solution...

Chris Johnsen has a good writeup of what causes this problem on github.

His tools work, but a better solution, if you have homebrew installed to:

brew install reattach-to-user-namespace

Then in your ~/.tmux.conf add these lines:

set-option -g default-command "reattach-to-user-namespace -l zsh" # or bash
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"

The first line ensures your shell can talk to pbpaste, pbcopy and launchctl now with no worries.

The second line lets you copy the tmux paste buffer into the Mac's paste buffer by typing control-b control-c (replace control-b with your tmux prefix key).

The third line will directly paste the Mac's paste buffer by typing control-v. As a side-effect it copies the Mac's paste buffer into tmux's paste buffer.

I'd prefer if I could nuke tmux's paste buffer entirely and have it paste directly into the Mac`s paste buffer, but... oh well.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .