Copy from a remote shell into your local clipboard with grok wrap
Copy from a remote shell into your local clipboard with grok wrap
Grok Build writes to the native OS clipboard, to the tmux paste buffer inside tmux, and emits OSC 52 for remote cases (SSH, containers, Linux). Apple Terminal ignores OSC 52 entirely, so copies over SSH never reach your local clipboard. Official: Terminal Support.
Use grok wrap
grok wrap runs a command in a local PTY that intercepts OSC 52 and writes to your machine’s clipboard. It is marked experimental in the docs.
grok wrap ssh user@host
grok wrap docker exec -it container bash
grok wrap kubectl exec -it pod -- bash
Inside the wrapped session, Grok (or anything emitting OSC 52) can copy to the clipboard on the machine where you launched grok wrap.
Other clipboard fixes
| Situation | Fix |
|---|---|
| iTerm2 ignores OSC 52 | Settings → General → Selection → enable “Applications in terminal may access clipboard” |
| Inside tmux | set -g set-clipboard on and set -g allow-passthrough on in ~/.tmux.conf, then tmux source-file ~/.tmux.conf |
| Diagnose what Grok detected | Run /terminal-setup (aliases /terminal-check, /terminal-info) inside the TUI |
Related
- Broader terminal chords and color fixes: Fix Grok Build terminal clipboard and keys
- CLI subcommands: Install the Grok Build CLI
Pitfalls
- Expecting bare
sshunder Apple Terminal to deliver OSC 52 copies — wrap the remote command instead. - Forgetting
grok wrapis experimental; keep a fallback (paste buffer, file, or local terminal with OSC 52 enabled).