I had the same problem—Tmux yanking suddenly stopped working for me. I didn’t change anything, yet it just broke.
At first, I ignored it, thinking it was a temporary issue. But when it didn’t fix itself, I searched online and found that others were facing the same problem. I came across this discussion in the tmux-yank GitHub repository:
After trying different solutions from the discussion, I finally got it working!
Tmux needs xclip (and possibly xsel) to properly integrate with the system clipboard. Install them using your package manager:
- Arch Linux:
sudo pacman -S xclip xsel
- Ubuntu/Debian:
sudo apt install xclip xsel
- Fedora:
sudo dnf install xclip xsel
Edit your Tmux configuration file:
~/.tmux.confor~/.config/tmux/tmux.conf(depending on your setup)
Add the following lines:
# Enable clipboard
set -g set-clipboard on
set -g @override_copy_command 'xclip -i -sel p -f | xclip -i -sel c'
set -g @yank_selection 'clipboard'
set-option -sa terminal-features ',*:clipboard'After saving the file, reload Tmux:
tmux source-file ~/.tmux.confNow, try yanking text again. It worked for me, and many others—hopefully, it works for you too!
💡 Credit: Huge thanks to the contributors in the GitHub issue who helped find this fix!