

How to copy and paste with tmux on Mac OS X - Croaky
http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux

======
the-come-ons
If you are on Linux, add this to your ~/.tmux.conf file.

    
    
      ##CLIPBOARD selection integration
      ##Requires prefix key before the command key
      #Copy tmux paste buffer to CLIPBOARD
      bind C-c run "tmux show-buffer | xclip -i -selection clipboard"
      #Copy CLIPBOARD to tmux paste buffer and paste tmux paste buffer
      bind C-v run "tmux set-buffer -- \\"$(xclip -o -selection clipboard)\\"; tmux paste-buffer"

------
joh6nn
could we please stop creating headlines that address everybody, when the
content only addresses specific sub-groups? This headline should have ended
with "on OS X". I seriously doubt i'm the only one who clicked through, only
to discover it was completely irrelevant to me.

~~~
Croaky
Ah, didn't think of that. Valid critique. Edited the headline.

------
iopuy
This article is an intro to the screencast the author has created and is
selling for $15 at <https://workshops.thoughtbot.com/pages/tmux> . It is
linked to at the bottom of the page. I really enjoy learning about new pieces
of software but in my personal opinion $15 for a 26 minute screencast is kind
of pricey.

~~~
joshclayton
The screencast covers a lot of things, including workflow, key bindings, and
tweaks to OS X to make you a faster developer. If you save ten minutes a day,
you'll have made up the cost of the screencast in a day or two - which, in my
opinion, is well worth it.

~~~
judofyr
Or you can buy the tmux book for $11 which tells pretty much the same:
<http://pragprog.com/book/bhtmux/tmux>

------
__david__
Can someone explain the use case for using tmux locally on your mac (which is
what this article seems to be about)? My only use for tmux right now is for
when I am ssh-ing into remote computers: It gives me a saved state so I don't
lose history or kill long running processes if I become disconnected and it
also gives me multiple tabs. But it seems that if I am local then Terminal.app
or iTerm2 already does all of that. So... why would I use tmux locally?

~~~
joshclayton
I use it to organize everything I'm doing. iTerm2 does splits, and both iTerm2
and Terminal do tabs, but using Tmux decouples my workflow from the operating
system I'm using. Additional benefits are being able to close my terminal at
the end of the day and reattach the next morning with all my programs open,
being able to script things I do often, etc.

------
JoelMcCracken
google trends for tmux vs screen

[http://www.google.com/trends/?q=tmux,+screen+gnu,+shell+scre...](http://www.google.com/trends/?q=tmux,+screen+gnu,+shell+screen&ctab=0&geo=all&date=all&sort=1)

~~~
pinko
Great idea, but I think the word "screen" is too overloaded (even alongside
GNU or shell) to be meaningful for comparison.

The useful information here is simply that tmux mentions are going up:
<[http://google.com/trends/?q=tmux>](http://google.com/trends/?q=tmux>).

------
tincholio
I might be missing the point, but at least with Emacs, copy and paste works
nicely from within tmux without doing any of this stuff.

Using clipboard-kill-ring-save and clipboard-yank (I have them bound to C-c c
and C-c v) just works.

------
nixme
reattach-to-user-namespace also fixes the following when running launchctl
from tmux:

    
    
      Bug: launchctl.c:2408 (24957):13: (dbfd = open(g_job_overrides_db_path, O_RDONLY | O_EXLOCK | O_CREAT, S_IRUSR | S_IWUSR)) != -1
      launch_msg(): Socket is not connected

------
j45
Very handy little snippet, now I just have to relearn vim

