Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbrich

Like pbcopy, but with support for arbitrary pasteboard types. Copy HTML, RTF, images, PDFs, or any other content type to the macOS clipboard.

Auto-detects PNG, JPEG, PDF, TIFF, and RTF from content. No flags needed for common formats.

Installation

brew install waynehoover/tap/pbrich

Or build from source:

make install

Usage

Drop-in replacement for pbcopy:

echo "hello" | pbrich

Copy an image to the clipboard (auto-detected):

cat screenshot.png | pbrich

Paste it directly into Slack, email, or any app that accepts images.

Copy a PDF (auto-detected):

cat report.pdf | pbrich

Copy RTF (auto-detected):

cat document.rtf | pbrich

Copy a clickable link (paste into Slack, Notion, etc.):

echo '<a href="https://github.com/waynehoover/pbrich">pbrich</a>' | pbrich -t public.html -p "https://github.com/waynehoover/pbrich"

Copy a URL (recognized as a link by browsers and Finder):

echo -n "https://github.com" | pbrich -t public.url

Set multiple types at once:

echo "<b>bold</b>" | pbrich -t public.html -t public.rtf

Copy a file reference (paste into Finder, email attachments, etc.):

pbrich -f screenshot.png

Copy multiple files:

pbrich -f report.pdf -f summary.pdf

Combine with other tools:

# Screenshot a window and copy to clipboard
screencapture -w -o /tmp/shot.png && cat /tmp/shot.png | pbrich

# Copy curl response as HTML
curl -s https://example.com | pbrich -t public.html

# Convert markdown to HTML and copy as rich text
echo "**bold** and *italic*" | pandoc -f markdown -t html | pbrich -t public.html -p "bold and italic"

# Screenshot a window and copy the file to paste as an attachment
screencapture -w -o /tmp/shot.png && pbrich -f /tmp/shot.png

Options

Flag Description
-t, --type Pasteboard type UTI (can be repeated). Overrides auto-detection
-p, --plain Also set a plain text fallback
-f, --file Copy file reference(s) to clipboard (like Cmd+C in Finder). Can be repeated
-l, --list-types List common pasteboard types
-v, --version Show version
-h, --help Show help

Supported Types

Any Uniform Type Identifier works. Common ones:

Type Description Example
public.utf8-plain-text Plain text (default) echo "hi" | pbrich
public.html HTML echo "<b>bold</b>" | pbrich -t public.html
public.rtf Rich Text Format cat doc.rtf | pbrich
public.png PNG image cat img.png | pbrich
public.jpeg JPEG image cat photo.jpg | pbrich
public.tiff TIFF image cat img.tiff | pbrich
com.adobe.pdf PDF document cat doc.pdf | pbrich
public.url URL echo -n "https://x.com" | pbrich -t public.url
public.file-url File URL echo -n "file:///tmp/f" | pbrich -t public.file-url
public.json JSON echo '{"a":1}' | pbrich -t public.json
public.xml XML cat data.xml | pbrich -t public.xml

Run pbrich --list-types to see this list in your terminal.

Similar Projects

  • pbcopy (built-in macOS) — Copies stdin to the clipboard as plain text only. Cannot handle images, HTML, RTF, or other rich types.
  • pbv / macos-pasteboard — Reads rich pasteboard types from the clipboard (the reverse direction).
  • cpfile — Copies file references to the clipboard via AppleScript (like Cmd+C in Finder).

History

View the changelog.

License

MIT

About

Like pbcopy, but with support for arbitrary pasteboard types

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages