macOS has no native way to save screenshots to both clipboard and file. Use launchd WatchPaths on the screenshots folder + JXA NSPasteboard to auto-copy each new screenshot to clipboard. Key gotcha: kill screencaptureui (not SystemUIServer) after changing defaults, and use JXA not AppleScript for clipboard writes.
macOS screenshot settings (com.apple.screencapture) support either target = clipboard (clipboard only, no file) or saving to a location (file only, no clipboard). There is no native "both" option.
Set macOS to save screenshots to a folder, then use a launchd agent with WatchPaths to auto-copy each new screenshot to the clipboard.
defaults write com.apple.screencapture location ~/Pictures/Screenshots
defaults delete com.apple.screencapture target # removes clipboard-only modeCritical: kill screencaptureui after changing defaults — it caches settings and won't re-read them until relaunched:
killall screencaptureuikillall SystemUIServer is NOT sufficient on modern macOS (Sequoia+). The screencaptureui process is separate and long-lived (runs for weeks).
Place at ~/.local/bin/screenshot-to-clipboard.sh:
#!/bin/bash
sleep 0.5 # let the file finish writing
NEWEST=$(ls -t "$HOME/Pictures/Screenshots"/*.png 2>/dev/null | head -1)
[ -z "$NEWEST" ] && exit 0
osascript -l JavaScript -e '
function run(argv) {
ObjC.import("AppKit");
var data = $.NSData.dataWithContentsOfFile(argv[0]);
if (data.isNil()) return "file not found";
var pb = $.NSPasteboard.generalPasteboard;
pb.clearContents;
pb.setDataForType(data, $.NSPasteboardTypePNG);
return "ok";
}' -- "$NEWEST"Key detail: AppleScript's read ... as class PNGf is broken on modern macOS (error -1700). Use JXA with NSPasteboard.setDataForType instead.
Create a plist at ~/Library/LaunchAgents/ with:
/bin/bash and the absolute path to the script aboveLoad with: launchctl bootstrap gui/$(id -u) <plist-path>
Note: launchd plists require absolute paths — expand ~ to your actual home directory.
defaults write is not enough — you must kill screencaptureui (not SystemUIServer) for changes to take effect.