11

Is there an actual file where the data is stored while I have something in my clipboard?

14

Pasteboard is handled by pbs process on OS X. Things which are copied are stored inside pbs address space. More about that is on Apple Pasteboard Server article.

Whether the data is transferred between objects in the same application or two different applications, in a Cocoa application the interface is the same—an NSPasteboard object accesses a shared repository where writers and readers meet to exchange data. The writer, referred to as the pasteboard owner, deposits data on a pasteboard instance and moves on. The reader then accesses the pasteboard asynchronously, at some unspecified point in the future. By that time, the writer object may not even exist anymore. For example, a user may have closed the source document or quit the application.

Consequently, when moving data between two different applications, and therefore two different address spaces, a third memory space gets involved so the data persists even in the absence of the source. NSPasteboard provides access to a third address space—a pasteboard server process (pbs)—that is always running in the background. The pasteboard server maintains an arbitrary number of individual pasteboards to distinguish among several concurrent data transfers.

5

As Mateusz pointed out, there's no file with this information. However, you can use pbcopy and pbpaste to manipulate the pasteboard.

For example, ls | pbcopy will copy the output (stdout) of ls to the pasteboard.

Man page for pbcopy.

3

The pasteboard server process is pboard not pbs, and you can verify that by checking the man pages for both.

Now that we know the correct process we can:

  1. load up Activity Monitor
  2. search for the pboard process
  3. get info using cmd+i
  4. view Open Files and Ports

We can see that the only files it has open are itself, dyld and the dyld cache.

enter image description here

  • It seems you are correct. I've opened the Console.app and after copying something I get logs from the pboard process. Strange that the info on Appe site is wrong. +1 – Mateusz Szlosek Mar 9 '18 at 8:30
  • 1
    @MateuszSzlosek yes it is strange. I've reported it but it's not been changed so far. – Matt Sephton Mar 9 '18 at 8:41

You must log in to answer this question.

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