Skip to content

Screenshot to clipboard path — built for CLI tools like Claude Code

License

Notifications You must be signed in to change notification settings

coreyepstein/screenshotpath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

screenshotpath

Screenshot → file → path on clipboard. Built for developers who work in the terminal.

When you take a screenshot with screenshotpath, it saves the file and copies the file path to your clipboard instead of the image. Paste it straight into Claude Code, a terminal command, or any text field.

Install

Homebrew:

brew tap coreyepstein/tap
brew install screenshotpath

curl:

curl -fsSL https://raw.githubusercontent.com/coreyepstein/screenshotpath/main/install.sh | sh

Manual:

git clone https://github.com/coreyepstein/screenshotpath.git
cp screenshotpath/bin/screenshotpath /usr/local/bin/
chmod +x /usr/local/bin/screenshotpath

Keyboard shortcut

screenshotpath is a CLI tool. Bind it to a hotkey so it works like the native screenshot shortcuts.

Automator (recommended)

  1. Open Automator → File → New → Quick Action
  2. Set "Workflow receives" to no input in any application
  3. Add a Run Shell Script action
  4. Set Shell to /bin/bash and paste:
    /usr/local/bin/screenshotpath
    
  5. Save as "Screenshot Path"
  6. Open System Settings → Keyboard → Keyboard Shortcuts → Services
  7. Find Screenshot Path under General and assign a shortcut

Recommended shortcut: ⌘⇧4 — this replaces the built-in area screenshot. To free it up:

  1. Go to System Settings → Keyboard → Keyboard Shortcuts → Screenshots
  2. Uncheck "Save picture of selected area as a file"
  3. Now ⌘⇧4 is available for your Quick Action

Hammerspoon

If you already use Hammerspoon, add to ~/.hammerspoon/init.lua:

hs.hotkey.bind({"cmd", "shift"}, "4", function()
    hs.execute("/usr/local/bin/screenshotpath", true)
end)

Apple Shortcuts

  1. Open Shortcuts app → New Shortcut
  2. Add Run Shell Script action
  3. Enter /usr/local/bin/screenshotpath
  4. Save, then assign a keyboard shortcut in System Settings → Keyboard → Keyboard Shortcuts → App Shortcuts

Usage

# Interactive area selection
screenshotpath

# Save to a custom directory
screenshotpath --dir ~/Desktop

# Skip the notification
screenshotpath --no-notify

During capture:

  • Click and drag to select an area
  • Press Space to switch to window selection mode
  • Press Escape to cancel

Configuration

Set in .zshrc or .bashrc:

Variable Default Description
SCREENSHOTPATH_DIR ~/Screenshots Where screenshots are saved
SCREENSHOTPATH_NOTIFY true Show macOS notification after capture
export SCREENSHOTPATH_DIR="$HOME/Documents/screenshots"
export SCREENSHOTPATH_NOTIFY=false

Use with Claude Code

This is the workflow screenshotpath was built for:

  1. You're in a Claude Code session and need to share a screenshot
  2. Press your shortcut, select the area
  3. Paste into the prompt — you get the file path
  4. Claude reads the image directly from the path

How it works

A ~50-line bash script that calls three native macOS tools:

  • screencapture -i -x — interactive area selection, no shutter sound
  • pbcopy — copies the file path to clipboard
  • osascript — shows a notification (optional)

No dependencies. No frameworks. No daemons. No background processes.

Troubleshooting

"screenshotpath: command not found" — Ensure /usr/local/bin is in your PATH. If installed via Homebrew, use $(brew --prefix)/bin/screenshotpath in your Automator action.

Automator shortcut doesn't work — Go to System Settings → Privacy & Security → Accessibility and ensure Automator is listed and enabled.

No screenshot taken, no error — macOS may need screen recording permission. Go to System Settings → Privacy & Security → Screen & System Audio Recording and allow the relevant app (Terminal, Automator, or your Shortcuts app).

Requirements

  • macOS (any version with screencapture)

License

MIT

About

Screenshot to clipboard path — built for CLI tools like Claude Code

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published