Pasting screenshots into Claude Code over SSH

I should soon be done with kicking Claude out of my personal MacBook to a local box. One of the first things I missed is the ability to paste screenshots with ⌃V: the remote terminal doesn’t know about my clipboard.

I wanted my solution to look like this:

  1. The Mac can initiate a connection to the VM where Claude is running, but not vice-versa.
  2. I decide whether a screenshot is transferred.
  3. I continue using Shottr, the best screenshot app for MacOS.
  4. Everything is fast. No manual or fiddly steps.

For the transport part, turns out Samuel Lawrentz had a similar need and published a CLI tool called clipssh: basically a Bash script that writes the image to a temporary file and copies it to the remote host. I didn’t want to install this with a package manager, so I just stuck the main script in .local/bin.

The second part is a shortcut in the Shortcuts app that comes into play after I’d already captured the screenshot: Shottr is now the frontmost app and pressing ⇧⌘D will set up some required variables, dismiss Shottr, and put the remote image path in my clipboard:

# expand the path so pngpaste (a dependency of clipssh) is there
export PATH="/opt/homebrew/bin:$HOME/.local/bin:$PATH"
export CLIPSSH_HOST="[email protected]"
export CLIPSSH_REMOTE_DIR="/tmp/claude-image-clipboard"
sleep 0.3
# dismiss Shottr (auto copies the screenshot to my local clipboard)
osascript -e 'tell application "System Events" to key code 53' 
sleep 0.3
clipssh

One thing left. 1Password kept prompting me to approve the SSH connection each time I invoked this, so I made the connection persist for 4 hours in ~/.ssh/config:

Host 100.113.x.x
  ControlMaster auto
  ControlPath ~/.ssh/cm-%C
  ControlPersist 4h