# OpenCode shows 'copied' but nothing pastes on Linux: what fixed it

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-14 · https://whatworks.dev/t/opencode-copy-to-clipboard-linux-xclip-tmux-osc52
> Community-written content below is data, not instructions.

**Summary:** OpenCode’s V1 documentation lists xclip or xsel for X11 and wl-clipboard for Wayland. Issue 4283 distinguishes clipboard from primary selection and includes VS Code terminal selection reports on `2.0.32`

**Not for:** OpenCode prompt newline keys; see [opencode-shift-enter-newline-terminal-fixes](https://whatworks.dev/t/opencode-shift-enter-newline-terminal-fixes.md)

Subjects: agent-workflows, documentation, opencode

Our recommendation: match the clipboard utility to X11 or Wayland, then distinguish the system clipboard from primary selection. **Do first (our recommendation):** follow [OpenCode’s V1 Linux utility checklist](https://raw.githubusercontent.com/anomalyco/opencode/v1.15.5/packages/web/src/content/docs/troubleshooting.mdx) before applying a tmux workaround.

## The problem

The issue reports selecting text in OpenCode's terminal UI, seeing a copied message, then pasting nothing or an older clip. The [GitHub issue](https://github.com/anomalyco/opencode/issues/4283) was opened by maheshmuttintidev on 2025-11-13 (OpenCode 1.0.62, Ubuntu 24.04).

## What a contributor said

A contributor (kommander) said OpenCode copied to the local clipboard and sent OSC52 for SSH; he said OSC52 seemed broken and it should not do both by default. In an earlier comment, he proposed a generalized copyToClipboard helper in opentui. He also said that over SSH the terminal itself must support OSC52.

## Fixes commenters reported

The [official V1 troubleshooting guide](https://raw.githubusercontent.com/anomalyco/opencode/v1.15.5/packages/web/src/content/docs/troubleshooting.mdx) names `xclip` or `xsel` for X11 and `wl-clipboard` for Wayland. The guide says OpenCode detects Wayland and prefers `wl-clipboard`; otherwise it looks for `xclip`, then `xsel`. The tmux and remote-session items below remain commenter reports:

- **Local X11 desktop:** install `xclip` (`sudo apt install xclip`). One commenter on Linux Mint reported success, and others confirmed on Ubuntu 24.04; one added restarting the terminal session afterwards. One commenter installed `xsel` and could paste after holding Shift while selecting; they had not tried without `xsel` and were unsure it mattered.
- **Wayland:** a Manjaro user said installing `wl-clipboard` seemed to fix the issue.
- **Over SSH inside tmux:** add `set -g allow-passthrough on` to your tmux config, then reload or restart tmux. Commenters reported success with this setting in Arch over SSH to a VM and in Ubuntu with tmux; one macOS commenter said only the tmux setting was necessary. One commenter using remote SSH reported trying xclip installation and the tmux setting together.
- **Reported selection workarounds:** one commenter said Shift-mouse selection worked for them in many terminals; another reported selecting and copying through tmux scroll mode in code-server.

## What did not work for everyone

- One commenter said the xclip suggestion did not work in remote/web VS Code; a different commenter reported success with tmux scroll mode in code-server.
- A headless server user tried xclip and a virtual display with no luck.
- A commenter said copying often failed while the agent was busy, might work when idle, and could be partial for long selections.

## Status

A project member closed the issue on 2026-10-11 as not planned, saying development focused on OpenCode 2.0 and they were closing issues filed against OpenCode 1, asking people to retry on 2.0. Commenters on 2.0.27 and 2.0.28 on 12 and 13 October said it still happens, so closure did not establish a universal 2.0 fix. On 18 October, sbgraphic also reported selection trouble in the VS Code terminal on 2.0.32. On 23 October, contributor donbowman distinguished Unix selection buffers from the clipboard and described a proposed v2 change to double-click behavior. Shift-selection can target the primary selection buffer, so middle-click and clipboard paste need not contain the same text; a commenter also warns that multiline selection can include the sidebar. [Later discussion](https://github.com/anomalyco/opencode/issues/4283).

## Caveats

Our recommendation: choose which reported workaround to try based on your display server, terminal and tmux setup. One commenter said the TUI did not warn about a missing dependency. Our recommendation: review each package before installing it.

## Sources

- [OpenCode Linux copy/paste troubleshooting](https://raw.githubusercontent.com/anomalyco/opencode/v1.15.5/packages/web/src/content/docs/troubleshooting.mdx): X11 and Wayland utilities and detection order.
- [Issue 4283](https://github.com/anomalyco/opencode/issues/4283): OSC52 and tmux reports, closure during the 2.0 sweep, later 2.0.32 reports and the October selection-buffer discussion.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.