5

In the past, I have pasted apps into TextEdit, which would show something like the following. I always thought that this was a convenient way to store app icons (as .icns files), in case I ever wanted to back a list of my apps up (just the names/icons, not the apps themselves) to manually download and install later.

I recently tried pasting about 20 apps into a TextEdit document, and the document turned out to be about 3GB large. This definitely is much larger than the .icns files for 20 apps. What exactly is stored in this TextEdit document?

enter image description here

2
  • 1
    If you use less in Terminal to look at the file, what do you see? – nohillside Aug 23 '20 at 14:30
  • 2
    @nohillside "Untitled.rtfd is a directory" :) – anki Aug 23 '20 at 14:59
6

When pasting an application into TextEdit as an RTF document and saved as Rich Text Document with Attachments it creates a Rich Text document bundle, e.g. Untitled.rtfd and will contain a copy of the application pasted into the document.

The more apps you paste into the document the larger it will be.

You can check the contents of the e.g. Untitled.rtfd document bundle by selecting it in Finder and right-click then select Show Package Contents.

There you will see a copy of each application bundle you've pasted into the Rich Text Document that was saved as Rich Text Document with Attachments.

5
  • My guess is the object being pasted is the icns object that contains all the various 2x / 3x and pre-rendered thumbnails of the full app icon - and not the entire code, but let’s see what the OP discovers. – bmike Aug 23 '20 at 14:48
  • 2
    @bmike, I know what I'm talking about! – user3439894 Aug 23 '20 at 14:49
  • That would be awesome if it embedded entire copies of the app! I agree - you do know what you’re talking about in general and in specific. If you paste Xcode - does it paste all aspects of the app or just the parts in /Applications? Similarly - could one copy a user folder or computer as backup mechanism - it will be interesting to probe how this was coded - if only apps are embedded and are runnable, etc... – bmike Aug 23 '20 at 14:50
  • 3
    @bmike, This is not rocket science, simple do it and then examine the document bundle, you'll see a complete copy of the pasted application bundle inside the root of the .rtfd document bundle. – user3439894 Aug 23 '20 at 14:54
  • 1
    I will indeed when I’m at a mac. I’ll move my answer to one asking how this works if that suits everyone more. – bmike Aug 23 '20 at 15:17
2

Apple’s copy / paste mechanism contains multitudes.

When you copy something - many levels of data are stored into the pasteboard object - literally a reference to these apps is available to any application that receives a paste command.

You can start on understanding this rich and complicated behavior with two items:

  1. An excellent app to show you what’s really on the pasteboard
  2. An excellent write up on how this all works.

For #1 I recommend the pasteboard viewer - https://sindresorhus.com/pasteboard-viewer - it’s on the MacApp Store and also source code is available under the MIT license.

For #2 I recommend the writings of Howard Oakley - his dives to the depths of the code and implementation yet writes clearly and in accessible terms. https://eclecticlight.co/2020/05/12/cut-copy-paste-inside-the-pasteboard-clipboard/

When you paste an item from the clipboard, its data are passed to the requesting app, which then performs any conversion necessary, and inserts it in the document.


So to answer your question, it’s possible you have all of the various resolution of the icon images pasted into your document, but I would need to examine either your document or your exact pasteboard contents prior to pasting to answer your question. Hopefully the general answer above helps everyone as well as you dig into specifics.

RTFD documents are plain text with attachments, so you can examine them in the command line or control click to show package contents just like other folders in Finder.

You must log in to answer this question.

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