Show HN: Cpcp – A smarter pbcopy for macOS that strips ANSI and newlines

vansh-j1 pts0 comments

GitHub - Vansh-j/CopyCopy: A smarter macOS clipboard copy utility. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Vansh-j

CopyCopy

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>3 Commits<br>3 Commits

Sources/cpcp

Sources/cpcp

Tests/cpcpTests

Tests/cpcpTests

.gitignore

.gitignore

Package.resolved

Package.resolved

Package.swift

Package.swift

README.md

README.md

View all files

Repository files navigation

CopyCopy (cpcp for short, hehe) 📋

A smarter macOS clipboard copy utility. cpcp is a drop in replacement for pbcopy that understands what you're trying to do.

⭐ Help get cpcp into Homebrew Core!<br>If you find this tool useful, please leave a star ⭐. We need 75 stars to submit this utility to the official Homebrew repository so everyone can install it without tapping.

The Problem with pbcopy

Native macOS pbcopy is good for basic scripting, but it has terrible developer UX:

It copies trailing newlines from pipes (echo "password" | pbcopy).

It copies invisible ANSI color codes from terminal logs, pasting gibberish into your editor.

It doesn't understand non text files (like images, PDFs, etc).

It offers zero feedback to tell you if the copy was successful (kinda not imp, but still).

cpcp fixes all of this.

Features

✨ Clean Pastes by Default: Automatically strips trailing whitespaces and newlines from pipes. No more accidental form submissions when pasting tokens or passwords.

🎨 ANSI Stripping: Pipes from grep --color=always or logs are stripped of invisible color codes so they paste perfectly.

🧠 Smart File Detection: cpcp image.png copies the actual image to your clipboard so you can paste it directly into Slack, Figma, or Chrome.

👁️ Human Feedback: Prints a subtle success message (✔ Copied 42 characters) to the terminal (but stays silent inside bash scripts).

Installation

Currently available via a custom Homebrew tap. (Note: Homebrew requires you to temporarily trust third-party taps, Give a ⭐ to submit this utility to the official Homebrew repository).

brew tap vansh-j/cpcp<br>brew trust vansh-j/cpcp<br>brew install cpcp

Usage

Copy text directly:

cpcp "Hello world"<br># ✔ Copied 11 characters

Pipe output (strips newlines & ANSI by default):

echo "password123" | cpcp<br># ✔ Copied 11 characters from pipe (Trailing newline removed!)

Copy file contents (Text):

cpcp notes.txt<br># ✔ Copied text contents of notes.txt

Copy file assets (Images, PDFs, etc.):

cpcp screenshot.png<br># ✔ Copied file asset: screenshot.png<br># Now hit Cmd+V in Slack, Figma, Browser, or Finder!

Options / Flags

**-r, --raw**: Keep raw formatting. Bypasses the auto-cleaner to keep trailing newlines and ANSI color codes intact.

**-t, --text-only**: Force input to be treated as literal text. Useful if you want to copy a string that happens to match a local file name (e.g., cpcp -t "image.png" copies the word, not the file).

Contributing

Pull requests are welcome!

Fork it

Create your feature branch (git checkout -b feature/MyFeature)

Commit your changes (git commit -m 'Add some MyFeature')

Push to the branch (git push origin feature/MyFeature)

Open a Pull Request

License

MIT License.

About

A smarter macOS clipboard copy utility.

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

star

Watchers

watching

Forks

forks

Report repository

Releases

v1.0.0 - Initial Release

Latest

Jul 4, 2026

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

Swift<br>100.0%

You can’t perform that action at this time.

cpcp copy file reload text pbcopy

Related Articles