Clipboard and copy/paste
Paste into the terminal, select and copy from it, write to the iOS clipboard from the host with OSC 52, and work around wrapped-code copy issues.
Copy and paste between iOS and a remote terminal looks simple but actually crosses three boundaries: your fingers, the iOS clipboard, and the host. Moshi tries to make each direction feel like the desktop equivalent of Cmd-C and Cmd-V.
Paste into the terminal
Several gestures all map to "paste from iOS clipboard at cursor":
The default double-tap binding can be reassigned in Gestures, and the toolbar paste button can be hidden or reordered in Settings -> Input.
Select and copy from the terminal
Long-press anywhere in the terminal to start a selection. Drag the handles to extend the selection, then tap Copy in the iOS context menu. The text lands on the iOS clipboard.
For long output that has scrolled past, prefer tmux copy mode instead — see Scrolling. Selecting huge regions on a phone screen is awkward, and copy mode also lets you search.
Remote → iOS clipboard with OSC 52
Moshi understands the OSC 52 escape sequence, so the remote shell can write directly to the iOS clipboard without you selecting anything:
$printf '\033]52;c;%s\033\\' "$(echo -n 'hello' | base64)"
That command puts hello on your iPhone clipboard. It works under SSH and mosh directly. Inside tmux you need one extra line so tmux passes the escape through instead of swallowing it:
$set -g set-clipboard on
This is the right primitive for "give me back a generated URL", "copy this token to my phone", or "send me the failing test name" without leaving the keyboard.
When copied code has broken lines
If you select a code block from an agent's output and paste it into a desktop editor, lines often arrive hard-wrapped at the terminal width. The cause is output-time wrapping: the agent rendered the code at the visible terminal width, and what scrolled into the buffer was already broken. Manual selection, the iOS share sheet, and tmux copy mode all preserve those wraps because the breaks are real characters in the buffer.
Two practical workarounds:
- Widen the terminal first (rotate to landscape, smaller font, or run on iPad) so the agent emits unwrapped lines, then copy.
- Have the agent emit the raw block as OSC 52 after rendering it. Most coding agents accept a small skill or instruction along the lines of "after every code block, additionally emit the raw block via OSC 52". The on-screen render stays unchanged; the iOS clipboard receives the clean version automatically.
Paste images, not text
When the thing you want to send is an image — a screenshot, a photo of a whiteboard, an annotated diagram — use Image paste instead of copy/paste. Images go through Moshi's upload service and reach the agent as a short URL without ever touching the host's filesystem.
Copying private keys
If you copy a private key out of Moshi, iOS requires biometric confirmation first — a deliberate friction step. Avoid leaving private keys in clipboard history, shared notes, or cross-device clipboards. See Security and sync for the rest of the credential model.