skip to Main Content

I am currently on MacOS Ventura. I typically use the Mac Terminal utility to ssh into an Ubuntu 20.04 machine. Once I’ve ssh’d into the Ubuntu machine, I’d like to use tmux (3.0a) to manage multiple panes/windows, but I’m having trouble copying from the tmux session to my mac.

I have installed xclip on the Ubuntu machine. and my .tmux.conf file looks like:

# Mouse support (e.g., click on different panes)
set -g mouse on

# Extend the history (line limit) in each pane
set-option -g history-limit 50000

set-window-option -g mode-keys vi
bind P paste-buffer
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi r send-keys -X rectangle-toggle
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

I got these commands from this blog and this stackoverflow question. While the vi key bindings work fine within tmux, the buffer contents do not percolate to my mac’s copy buffer.

I’d appreciate any help with this!

2

Answers


  1. Chosen as BEST ANSWER

    I wasn't able to get tmux copy mode to copy into my local clipboard, but I did find a workaround that allows me to copy from a tmux terminal, which solves my problem (if not my question).

    I was able to successfully copy/paste from my mac into/from a ssh tmux window with the commands fn+cmd+c (select text with mouse while holding the keys down, then release keys and press enter) for copy and fn+cmd+v for paste. It's a bit clunky and I'm not sure why this works, but it does.


  2. I use this in my config on macOS AND linux. Works in both.

    tmux_conf_copy_to_os_clipboard=true
    
    bind -T copy-mode-vi y send -X copy-selection-and-cancel
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search