Is there a way to see the contents of my clipboard in a way that shows me what formatting metadata is included?

Or to get to the question behind the question: is there a way to generate output in a script so that if I pipe the output to pbcopy it will include the formatting?

Specific example: if I write a script that generates a newline-delimited list of names, and then paste it into a table in Confluence, it will just dump the results into a single cell. I'd like to be able to paste it so that the whole column is filled up (with one name per cell).

I can do this by pasting the results into a Google Spreadsheet and then re-copying the column from Google Spreadsheet. For some reason that adds invisible formatting that allows me to paste the cells into Confluence, but when I inspect the clipboard (in Finder's Edit->Show Clipboard, or using pbpaste | hexdump) it seems exactly the same as the output of my script. I've often had this problem with formatting text for the clipboard, and I'd really like to know what tricks there are for viewing and generating this magical invisible formatting.

  • Did you try pbpaste -rtf | hexdump?
    – nohillside
    Commented Apr 10, 2015 at 13:48
  • pbpaste doesn't seem to have an -rtf option, but it does have -Prefer rtf. But that just seems to get the text out of the "rtf" buffer, but still pastes it as plaintext with the formatting stripped out. Commented Feb 9, 2021 at 17:43
  • 1
    If you’re on the development side of things github.com/sindresorhus/Pasteboard-Viewer is excellent
    – bmike
    Commented Jul 5, 2022 at 9:21
  • @bmike - that's pretty cool. You should suggest that as an answer Commented Jul 5, 2022 at 12:07
  • 1
    Since you’ve already selected an answer, I made anki’s post better. You are free to edit posts, too :) I’m still learning enough to make a proper answer on this topic.
    – bmike
    Commented Jul 5, 2022 at 12:09

2 Answers 2


For a GUI option:

Download Additional tools for Xcode from https://developer.apple.com/download/all/?q=xcode

Open Clipboard Viewer. It doesn't seem to have a CLI interface though.

From Finder, you can also inspect the clip board from the edit menu

  • Show Clipboard

There’s also a tool pbv which handles rich text better than the pbpaste command does.

  • The Finder has a built-in window to display the Clipboard's content.
    – benwiggy
    Commented Mar 3, 2022 at 14:20
  • @benwiggy Does it?
    – nohillside
    Commented Mar 3, 2022 at 14:40
  • 3
    @nohillside Yes, Edit > Show Clipboard. If the text is formatted, it will show the formatting.
    – benwiggy
    Commented Mar 3, 2022 at 16:45
  • 2
    @benwiggy I‘m using OS X/macOS for nearly 20 years now, never noticed that. Thanks :-)
    – nohillside
    Commented Mar 3, 2022 at 17:01
  • @nohillside It's been there since Classic Mac days!
    – benwiggy
    Commented Mar 3, 2022 at 19:02

An thing on the clipboard is actually an OO-style object which has methods to render itself appropriately in each context. So the reason that your hex dump from PBCOPY is the same even when the object on the clipboard is different is because the text-only renderings are both the same.

Just as a file on the clip board will render as its ascii file path in contexts that only accept text pastes. I believe that pbcopy and pbpaste only operate with this textual format for the objects on the clipboard, so you cannot use them to do what you are aiming to do.

If I understand your objective correctly, you could hack it, by using an application like textedit, and feed the application as an rtf (rich text formatted file) then send a COMMAND-A, then COMMAND-C to the text edit application (or perhaps a text-edit specific dictionary commands).

This is really hacky, and it would result in visible action on your screen, but it would be a scripted way to get ascii encoded markup onto the clipboard.

Post a follow up, if you want help implementing this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .