How to select and copy text with the mouse in tmux?
Short answer
# ~/.tmux.conf
set -g mouse on
The mouse is off by default on tmux 3.2a. Once mouse on is set, dragging across a pane enters
copy mode and copies the selection into the tmux paste buffer on release. Paste it back with
prefix ].
Details
With mouse on, a left-drag runs copy-mode -M and starts selecting; releasing the button runs
copy-pipe-and-cancel, which copies the text to the tmux buffer and leaves copy mode. The catch is
that this is the tmux buffer, not your system clipboard: prefix ] pastes inside tmux, but
another application will not see it unless you wire copy mode to a clipboard tool (pbcopy on
macOS, xclip or wl-copy on Linux).
To use the terminal’s own selection and clipboard instead, hold Shift while you drag. That
bypasses tmux entirely, so you get the native copy-paste your terminal emulator already provides,
which is the quickest way to grab text without configuring anything.
Turning the mouse on also enables click-to-focus a pane, click a window name in the status bar to
switch to it, scroll to enter copy mode and walk the scrollback, and drag a border to resize. A
right-click on a pane (MouseDown3Pane) opens a context menu with copy, paste, split, swap and
zoom actions.
Verified on tmux 3.2a.