2 years ago

#37698

test-img

iRestMyCaseYourHonor

How to copy text from tmux to clipboard in Mac OS Monterey with terminal app

I am using Tmux version 3.2a. I used this tutorial and many more to enable this functionality but couldn't achieve it so far.

The main problem is when I copy the following code to the tmux config,

bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind P paste-buffer
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

and get to the copy mode with ctrl+b and then ctrl+[, and press v to get into to the visual mode, nothing happens.

My final tmux config is

set-option -g mouse on
setw -g mode-keys vi
set-option -s set-clipboard off
bind P paste-buffer
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"

I can not use normal v bindings like u and d for scrolling. I use the terminal app that comes with Mac OS Monterey.

The closest I come was to hold down the fn button and simply select the text. This works to some extent but has a major problem. When I scroll the terminal output, it does not show anything above as understandable from the figure hopefully.

enter image description here

The empty part occurs when I scroll up.

macos

terminal

tmux

0 Answers

Your Answer

Accepted video resources