gcopy (global copy) is a command line tool that copies data to your clipboard on MacOS.
It does what pbcopy does but with some extra features:
- Works with images, so copied images can be pasted in other applications
- Accepts arbitrary
STDINvia a pipe - If a filename is passed as an argument it'll copy the data as though you hit
CMD+CviaFinder, allowing pasting of files (PDFs, archive files, videos etc.) to other programs - Has an optional flag to copy the absolute pathname of a file or folder to the clipboard
- Written in Go, deployed as a multi-arch static binary
- Works as a drop-in replacement for
pbcopysince it extends its features
go install github.com/TheDen/gcopy@latestTo install via brew
brew tap theden/gcopy
brew install gcopygcopy can be used as a drop-in replacement for pbcopy. To do this, add the alias into your .bashrc or similar
alias pbcopy='gcopy'usage: gcopy [file] [STDIN] [-h|--help] [-v|--version] [-p|--path]
gcopy: copy content to the clipboard
Arguments:
-h --help Print help information
-v --version Current version
-p --path Copy (and show) the absolute pathname of a file or folder to
the clipboardWorks with text or arbitrary data
cat main.go | gcopy
# or
gcopy < main.goImages can also be copied via pipes, and then pasted as images to GUI applications
cat image.png | gcopy
# or
gcopy < image.pnggcopy main.goSimilarly for images
gcopy image.pngOr any other type of file
gcopy backups.zipCopying via this method will allow you to paste non-text data in other applications
gcopy -p .bashrc
/Users/den/.bashrc