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.
brew install waynehoover/tap/pbrichOr build from source:
make installDrop-in replacement for pbcopy:
echo "hello" | pbrichCopy an image to the clipboard (auto-detected):
cat screenshot.png | pbrichPaste it directly into Slack, email, or any app that accepts images.
Copy a PDF (auto-detected):
cat report.pdf | pbrichCopy RTF (auto-detected):
cat document.rtf | pbrichCopy 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.urlSet multiple types at once:
echo "<b>bold</b>" | pbrich -t public.html -t public.rtfCopy a file reference (paste into Finder, email attachments, etc.):
pbrich -f screenshot.pngCopy multiple files:
pbrich -f report.pdf -f summary.pdfCombine 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| 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 |
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.
- 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).
View the changelog.
MIT