1

I'd tried using iTerm2 beta Build 1.0.0.20120724 and using bind C-y run-shell "reattach-to-user-namespace -l zsh -c 'tmux show-buffer | pbcopy'" in .tmux.conf but none works.

The solutions I found aren't specific about the system and conditions. Hence I hope the problem statement here is clear ie. Copying text from remote to OS X clipboard via iTerm2 with Tmux.

Problem:

  1. Copy text output from cat of a log file that's longer than a screen.

  2. Copy text from vertically* split screen (left and right panes) without copying the text from the other pane.
    *not sure if it should be called vertically or horizontally split.

  3. Copy text through Vim that's longer than a screen.

I'm aware of holding alt while clicking and drag to select the text. But the problem arises when you need to scroll, or are working in more than 1 pane.

3
  • When you say "remote", do you mean you are running tmux on the remote side of an ssh connection?
    – chepner
    Commented Feb 13, 2013 at 15:25
  • @chepner yes, you're right.
    – resting
    Commented Feb 14, 2013 at 16:28
  • automizu's answer may be exactly what you need, but I'll refer you to my own answer on unix stackexchange. In addition to that, you would probably want tmux's save-buffer command. Commented Jul 30, 2013 at 1:49

3 Answers 3

0

This app might solve your problem, clipper.

I came across this software sometime earlier, but I have never used it. It has a screencast and it seems just to fit your need exactly.

0

JIC, in some cases it'd be enough to just run command through SSH and copy result with pbcopy, like this:

ssh yourhost.net 'ls /' | pbcopy
2
  • 1
    Please explain 'in some cases'
    – Jan Doggen
    Commented Aug 6, 2014 at 8:48
  • 1
    With some cases he probably means where you have a direct connection the the target machine and are able to reverse ssh the pbcopy command. In that scenario this works.
    – holmberd
    Commented May 28, 2019 at 19:09
0

This answer from stackoverflow may be the simplest answer. If you hold the option key, you can select and copy text in iTerm2 even if it is from a remote session running tmux.

You must log in to answer this question.

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