Apple - Where is clipboard data stored?
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.
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.
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:
- load up Activity Monitor
- search for the
pboard
process - get info using cmd+i
- view Open Files and Ports
We can see that the only files it has open are itself, dyld and the dyld cache.