You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clipboard copy not working over SSH + tmux in Ghostty #15907
OpenCode's copy function shows "copied to clipboard" notification but doesn't actually update the system clipboard when running over SSH inside tmux.
Description
OpenCode's copy function shows "copied to clipboard" notification but doesn't actually update the system clipboard when running over SSH inside tmux.
Environment
Terminal: Ghostty on macOS
Remote: SSH into Linux workstation
Multiplexer: tmux with set -g set-clipboard on
OpenCode pane: right side of a tmux split
Steps to Reproduce
SSH into a remote machine from Ghostty
Start tmux with a horizontal split – shell on the left, OpenCode on the right
Highlight/copy text from the OpenCode pane
Attempt to paste with Cmd+V
Expected
Copied text appears in the macOS clipboard.
Actual
OpenCode shows "copied to clipboard" notification, but Cmd+V pastes the previous clipboard content. The clipboard is not updated.
Notes
Copying from the shell pane in the same tmux session works correctly – clipboard is updated and Cmd+V pastes the new content.
This suggests tmux and Ghostty OSC 52 passthrough are configured correctly, and the issue is specific to how OpenCode emits the OSC 52 sequence.
Plugins
N/A
OpenCode version
1.2.15
Steps to reproduce
SSH into a remote machine from Ghostty
Start tmux with a horizontal split – shell on the left, OpenCode on the right
Highlight/copy text from the OpenCode pane
Attempt to paste with Cmd+V
Screenshot and/or share link
No response
Operating System
MacOS 26.3
Terminal
Ghostty
Reacted by plozy, Kevin Bloch, Lalit Kale, Hlib Holynskyi, Nathan Chilton, OdooPudakMachinery, Nanda Firmansyah, Stéphane Brunner, savanne-kham, Victor Castell and 2 more
If your issue is covered by one of these, consider adding a comment there with your specific environment details (SSH + tmux + Ghostty) rather than a new issue.
If you're on macOS, clipaste may help — it's a background daemon that normalizes the screenshot clipboard so image paste works in terminal AI tools. Also supports SSH remote paste.
I'm not using ghostty, i'm using iterm2, ssh into linux, then running tmux. But i found this thread looking for answers to this and set -g allow-passthrough on was what I needed.
❯ cat ~/.tmux.conf
# ==================================
# == COMMON SETTINGS (for all OS) ==
# ==================================
# These settings will apply to both Linux and macOS
set-option -g mouse on
set-option -g set-clipboard on
set -g allow-passthrough on
# Enable OSC 52 clipboard (works for mouse copy, even over SSH)
# This tells tmux to use the terminal's clipboard
set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\a'
# Pane navigation
bind h select-pane -L # left
bind j select-pane -D # down
bind k select-pane -U # up
bind l select-pane -R # right
# Window navigation
bind n previous-window
bind m next-window
# ====================================
# == OS-SPECIFIC SETTINGS ==
# ====================================
# Change status bar to teal if on dev-box
if-shell "[ $(hostname) = 'dev-box' ]" \
"set -g status-bg colour36" \
"set-option -g allow-passthrough on"
# -----------------
# --- macOS (Darwin) ---
# -----------------
if-shell "test $(uname) = 'Darwin'" " \
bind-key -T copy-mode-vi v send-keys -X begin-selection; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'; \
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'pbcopy' \; \
bind p run 'pbpaste | tmux load-buffer - ; tmux paste-buffer' \
"
# ====================================
# == PANE & WINDOW CREATION ==
# ====================================
# Split panes using current directory
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Open new windows in the current directory
bind c new-window -c "#{pane_current_path}"
Does opencode even support tmux clipboard in the first place without using xclip? I want opencode to copy to the tmux clipboard without messing with the system clipboards
Why it works: OpenCode seems to use xclip as a fallback for copying to the clipboard when OSC52 fails (which happens in certain Linux terminals with Wayland).
Before this, auto-copy-on-select showed "Copied to clipboard" but never reached the clipboard. After installing xclip, it works perfectly.
Note: the solution is simple and doesn't require changing terminals or disabling Wayland. Hope this helps other users with the same issue.
Activity
github-actions commentedon Mar 3, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is covered by one of these, consider adding a comment there with your specific environment details (SSH + tmux + Ghostty) rather than a new issue.
Ayoola commentedon Mar 3, 2026
This resolved my issue @thdxr:
Ghostty: allow OSC52 clipboard access
tmux: allow OSC52 passthrough
set -g allow-passthrough onSource: https://petar.dev/notes/copypaste-for-opencode-with-ghostty-and-tmux/
vcastellm commentedon Mar 18, 2026
Thx @Ayoola that fixed the issue for me
hqhq1025 commentedon Apr 12, 2026
If you're on macOS, clipaste may help — it's a background daemon that normalizes the screenshot clipboard so image paste works in terminal AI tools. Also supports SSH remote paste.
For SSH remote:
clipaste ssh-setup user@hostGitHub: https://github.com/hqhq1025/clipaste
bts-ericwooley commentedon Apr 23, 2026
I'm not using ghostty, i'm using iterm2, ssh into linux, then running tmux. But i found this thread looking for answers to this and
set -g allow-passthrough onwas what I needed.is my full tmux
SOF3 commentedon May 12, 2026
Does opencode even support tmux clipboard in the first place without using xclip? I want opencode to copy to the tmux clipboard without messing with the system clipboards
pcfreak30 commentedon May 14, 2026
This solved for me as well. have to use ghosty and tmux for the full terminal wire protocol.
joelceo commentedon May 20, 2026
Solution found: install xclip
sudo apt install xclip
My environment:
Why it works: OpenCode seems to use xclip as a fallback for copying to the clipboard when OSC52 fails (which happens in certain Linux terminals with Wayland).
Before this, auto-copy-on-select showed "Copied to clipboard" but never reached the clipboard. After installing xclip, it works perfectly.
Note: the solution is simple and doesn't require changing terminals or disabling Wayland. Hope this helps other users with the same issue.
finnvyrn commentedon Jun 26, 2026
I also met this issue with Hyprland and macOS
vcastellm commentedon Jun 30, 2026
This worked with these settings at this point #15907 (comment) then it stopped working this is Ghostty related.