[BUG] /copy command fails to write to X11 CLIPBOARD on Linux
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
## Environment
- OS: Ubuntu 24.04 (MATE desktop)
- Display: X11
- Clipboard tools: xclip, xsel installed
## Bug Description
The /copy command reports "Copied to clipboard (N characters)" but the content is not written to the X11 CLIPBOARD selection.
## Investigation Results
/copysometimes writes to PRIMARY selection, sometimes writes to neither- CLIPBOARD selection remains empty or unchanged after
/copy - Behavior is inconsistent across invocations
- Manual
echo "test" | xclip -selection clipboardworks correctly - Emacs
clipboard-yankworks with manually set CLIPBOARD content xclip -selection clipboard -oreturns empty after/copy
What Should Happen?
/copy should reliably write to the X11 CLIPBOARD selection so that Ctrl+V, Emacs clipboard-yank, and other standard paste operations work correctly on Linux.
Error Messages/Logs
Steps to Reproduce
- Run Claude Code on Ubuntu 24.04 (MATE desktop, X11)
- Get a response from Claude
- Run /copy (shows "Copied to clipboard (N characters)")
- Run xclip -selection clipboard -o → empty or stale content
- Run xclip -selection primary -o → sometimes has content, sometimes empty
- Ctrl+V or Emacs clipboard-yank fails to paste the copied content
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.72
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗