Show HN: Clippy – a better pbcopy for macOS that handles files properly
github.comI made clippy because pbcopy can't do something I needed every day: copy files to paste into GUI apps. When you pbcopy < image.png, you get raw bytes instead of a file that Slack or email can use.
Clippy fixes this:
- clippy report.pdf → ⌘V into any app uploads the file
- curl image.png | clippy → pipes become pasteable files
- clippy *.jpg → multiple files at once
- Text files still work like pbcopy
Technical: Direct Objective-C bindings via CGo. Copies file references (like Finder), not contents. Auto-cleans temp files. No AppleScript hacks.
Install: brew install neilberkman/clippy/clippy
So technically the OS is supposed to be handling this, or at the least whatever app you're in is supposed to signal the MIME to the pasteboard. They even updated the APIs for it this year. I'm not complaining, just giving away loose headsup that they might rugpull you. Apple is particularly not a fan of oblique data transformations, especially since malware keeps going after the user's pasteboards.
Something worth implementing is multiple layers to the pasteboard content, so you're at least maintaining the original raw bytes. That and I always wanted a pasteboard that let you append contents to it. Just some ideas to consider
Thanks. I just released a new version with UTI based MIME type detection as the primary method with a fallback to the existing content-based detection.
A certain large software concern might take issue with the name. Mac users of a certain age might just run…
they'd love my little clipboard/AI project name, then
https://github.com/aae42/clippy-clippy/
i like the name, it is easy to remember for this use case :)
> the name
Rust's linter is also called Clippy, and they don't seem to have any issues.
Probably worth knowing, there’s already a popular clipboard manager in the wild for MacOS called Clipy.
https://github.com/Clipy/Clipy
Neat, I was actually looking for something like this a few months ago to help automate part of a workflow.
Be kind of nice if this also worked as a library rather than having all the workings in internal where they can't be called.
Unrelated: Is yo.txt in the root just junk?
Added a library:
https://github.com/neilberkman/clippy?tab=readme-ov-file#usi...
Removed, thanks!
linux compat would've been nice
already exists, xsel and xclip does that, iirc.
clippy is a bit different from these - rather than requiring manual flags for MIME types, it automatically detects the content type. The idea is to make the CLI's copy/paste feel as intuitive as the GUI's.
I might tackle Linux (and Windows) at some point, but contributions are definitely welcome!