Skip to content

Instantly share code, notes, and snippets.

@harilvfs
Last active April 3, 2025 17:38
Show Gist options
  • Save harilvfs/7ce5a5b2fd23a5a47ca4ba2fc7a5efb8 to your computer and use it in GitHub Desktop.
Save harilvfs/7ce5a5b2fd23a5a47ca4ba2fc7a5efb8 to your computer and use it in GitHub Desktop.
Tmux yank now working [Fix]

Fix: Tmux Yank Not Working

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:

🔗 Tmux Yank Issue #172

After trying different solutions from the discussion, I finally got it working!

🔧 Solution

1️⃣ Install xclip and xsel

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

2️⃣ Update Your Tmux Config

Edit your Tmux configuration file:

  • ~/.tmux.conf or
  • ~/.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'

3️⃣ Reload Tmux Configuration

After saving the file, reload Tmux:

tmux source-file ~/.tmux.conf

Now, 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment