https://github.com/theden/gcopy
Copy data to your clipboard via the command line (including images, archive files, videos etc.) 📋
https://github.com/theden/gcopy
clipboard command-line macos pbcopy terminal
Last synced: 8 months ago
JSON representation
Copy data to your clipboard via the command line (including images, archive files, videos etc.) 📋
- Host: GitHub
- URL: https://github.com/theden/gcopy
- Owner: TheDen
- License: gpl-2.0
- Created: 2022-11-26T15:51:42.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-05-15T10:25:53.000Z (about 1 year ago)
- Last Synced: 2025-05-15T11:39:59.754Z (about 1 year ago)
- Topics: clipboard, command-line, macos, pbcopy, terminal
- Language: Go
- Homepage:
- Size: 3.54 MB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcopy

[](https://pkg.go.dev/github.com/TheDen/gcopy)
[](https://github.com/prettier/prettier)
[](https://github.com/TheDen/gcopy/releases/latest)
[](https://github.com/TheDen/gcopy/actions?query=branch%3Amain)
[](/LICENCE)
`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 `STDIN` via a pipe
- If a filename is passed as an argument it'll copy the data as though you hit `CMD+C` via `Finder`, 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 `pbcopy` since it extends its features

# Install
## Via `go install`
```shell
go install github.com/TheDen/gcopy@latest
```
## Brew
To install via `brew`
```shell
brew tap theden/gcopy
brew install gcopy
```
# Aliasing
`gcopy` can be used as a drop-in replacement for `pbcopy`. To do this, add the `alias` into your `.bashrc` or similar
```shell
alias pbcopy='gcopy'
```
# Usage
## Overview
```bash
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 clipboard
```
## Copying to clipboard via STDIN
Works with text or arbitrary data
```shell
cat main.go | gcopy
# or
gcopy < main.go
```
Images can also be copied via pipes, and then pasted as images to GUI applications
```shell
cat image.png | gcopy
# or
gcopy < image.png
```
## Passing in files to copy to the clipboard
```shell
gcopy main.go
```
Similarly for images
```shell
gcopy image.png
```
Or any other type of file
```shell
gcopy backups.zip
```
Copying via this method will allow you to paste non-text data in other applications
## Getting the absolute path of a file or folder
```shell
gcopy -p .bashrc
/Users/den/.bashrc
```