DEV Community

Steven Gonsalvez
Steven Gonsalvez

Posted on • Originally published at stevengonsalvez.com

Paste Images into Claude Code Over SSH with a Raycast Script

The Problem

Claude Code running on a remote machine over SSH can read local files on that machine. It cannot receive images pasted from your Mac's clipboard — the paste never crosses the SSH boundary.

The workaround: upload the image to the remote machine first, then paste the file path. Claude reads the path, loads the file.

The Script

A single Raycast Script Command handles the whole thing:

  1. Copy an image to your clipboard (Cmd-Ctrl-Shift-4 for a region, or copy from anywhere)
  2. Trigger the hotkey
  3. The image is streamed to /tmp/ on the remote machine via Tailscale SSH
  4. The bare remote path replaces your clipboard contents
  5. Paste into your Claude Code session
Cmd-Ctrl-Shift-4
  → hotkey
  → Copied: /tmp/cc-paste-20260617-143201-12345.png
  → ⌘V into SSH session
Enter fullscreen mode Exit fullscreen mode

Claude picks up the path with its Read tool. No extra steps.

Setup

brew install pngpaste
Enter fullscreen mode Exit fullscreen mode

Grab the script from the agents-in-a-box repo, drop it into your Raycast Script Commands directory, and update REMOTE_HOST to match your SSH alias.

In Raycast: Settings → Extensions → Script Commands → add your scripts directory → bind a hotkey.

What it checks before transferring

  • pngpaste installed
  • tailscale running
  • Remote peer online
  • Clipboard actually contains an image (aborts with a HUD error if not)
  • Remote file is non-empty after write (verifies the transfer)

Local temp file is cleaned up via trap on exit regardless of outcome.

Requirements

  • macOS with Raycast
  • pngpaste (brew install pngpaste)
  • Tailscale with the remote host reachable
  • Key-based SSH auth to the remote (no password prompts)

Top comments (0)