Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

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

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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