{
"$type": "site.standard.document",
"description": "How I copy macOS screenshot file paths into Claude Code's terminal CLI automatically, first with a fish function and now with my shotpath CLI tool.",
"path": "/automatically-copy-macos-screenshot-path-for-claude-code/",
"publishedAt": "2025-10-16T10:23:00.000Z",
"site": "at://did:plc:bryys25pc2fnagnyxqgsglhd/site.standard.publication/3mn26bjkkmh23",
"tags": [
"macOS",
"Scripts",
"AI"
],
"textContent": "Claude Code is my tool of choice for AI coding. I wrote about using Claude Code here.\n\nClaude Code as well as several silent agentic CLI tools support dropping in an image file or pasting an image filepath. It's very useful for referring to screenshots. I used it all the time, but it's tedious to type and then:\n\n 1. cmd+shift+4 and drag to make a screenshot\n 2. F11 (macOS Exposé) to reveal desktop\n 3. Drag the image file from the desktop\n 4. F11 to end Exposé\n 5. Drag the image file and drop onto Claude Code\n\nStep 3 has gotten worse with macOS Tahoe where the desktop seem to take longer to refresh so I made a fish function so that the process becomes:\n\n 1. cmd+shift+4 and drag to make a screenshot\n 2. Paste the image file path into Claude Code\n\nNo waiting for macOS Tahoe, and much, much faster.\n\nThe short answer: Claude Code's terminal UI can work with a screenshot path, so I copy the path automatically and paste it into the CLI.\n\nHere's the fish function. Just keep it running in a terminal window:\n\n#Run by itself and keep running to watch for new screenshots and copy to clipboard. Useful for pasting them into Claude Code instead of dragging and dropping files\nfunction watchscreenshots\n fswatch -0 --monitor fsevents_monitor --latency 0.1 \\\n --event Created --event Renamed --event Updated ~/Desktop | while read -z path\n test -f \"$path\"; or continue\n set base (basename -- \"$path\")\n\n # Match macOS-style screenshots only\n if string match -q \"Screenshot * at *.*.png\" \"$base\"\n # Wait briefly for the file to finish writing\n #sleep 0.2\n printf \"%s\" \"$path\" | pbcopy\n terminal-notifier -title \"Screenshot\" -message \"Path copied: $base\" -group \"screenshotpaths\" >/dev/null 2>&1\n sleep 2\n # Detach from stdin/stdout so terminal-notifier doesn't hang when run inside a pipeline (e.g. fswatch | while read ...).\n # </dev/null prevents it from waiting for input, >/dev/null 2>&1 silences output/errors.\n #terminal-notifier -remove \"screenshotpaths\"\n terminal-notifier -remove screenshotpaths </dev/null >/dev/null 2>&1\n end\n end\nend\n\nUpdate: I've since turned this into a proper CLI tool called shotpath — a single Swift binary with no dependencies. Install via Homebrew and run it as a background service.\n\nbrew tap hboon/tap\nbrew install shotpath\nbrew services start hboon/tap/shotpath\n\nThe fish function below is still useful if you want to see exactly what is happening. For daily use, I use shotpath now because it does not need a terminal window sitting around just to watch the Desktop.\n\nWHY PASTE THE FILE PATH\n\nDragging a screenshot into a terminal workflow is awkward. Pasting the path keeps me in the keyboard flow:\n\n/Users/hboon/Desktop/Screenshot 2026-05-20 at 10.31.42 AM.png\n\nI can take a screenshot, paste the path into Claude Code, and ask it to inspect the UI, error, email, or terminal output in that image.\n\nThis also works better with multiple coding agents. If I am in tmux, I can paste the same screenshot path into Claude Code, Droid, or Codex without leaving the pane. The file stays on disk, so I can reuse the path later in the thread if the agent needs to compare the same UI state against a later screenshot.\n\nHave fun!",
"title": "Automatically Copy macOS Screenshot Path for Claude Code",
"updatedAt": "2026-06-04T00:00:00.000Z"
}