At some time late in the last century, probably around 1999 in Mac OS 9, Apple introduced the textClipping, a small document normally created on the Desktop, containing a chunk of styled text that had been dragged from a selection in a document. These developed into three types according to their contents:
- webloc, containing the link to a webpage in the form of a URL string like
https://developer.apple.com, - mailloc, containing an email address in the form of a URL string like
mailto:name@domain.com, - textClipping, containing text in one or more formats with general content.
In those days, before the arrival of Mac OS X, their type was set using four-character OSType codes, but they have since gained their own filename extensions and UTIs:
- extension webloc, OSTyp…
At some time late in the last century, probably around 1999 in Mac OS 9, Apple introduced the textClipping, a small document normally created on the Desktop, containing a chunk of styled text that had been dragged from a selection in a document. These developed into three types according to their contents:
- webloc, containing the link to a webpage in the form of a URL string like
https://developer.apple.com, - mailloc, containing an email address in the form of a URL string like
mailto:name@domain.com, - textClipping, containing text in one or more formats with general content.
In those days, before the arrival of Mac OS X, their type was set using four-character OSType codes, but they have since gained their own filename extensions and UTIs:
- extension webloc, OSType
ilht, UTI com.apple.web-internet-location, conforming to com.apple.internet-location - mailloc,
ilma, com.apple.mail-internet-location, com.apple.internet-location - textClipping,
clpt, com.apple.finder.textclipping, com.apple.finder.clipping.
Note that these textClippings are distinct and different from the Clipboard, although Clipboard items are sometimes referred to as clippings.
History
Although Mac OS X was only just over the horizon at the time, these were implemented using the Resource fork. As a result, early textClipping files contained no data, and all their content was stored in the Resource fork, which was soon to become the com.apple.ResourceFork xattr in Mac OS X.
When released in 2001, Mac OS X continued to support the three clipping formats, which remained undocumented and proprietary. At some stage their content was also saved to the file data, apparently in the form of a property list, and most recently as a binary property list, bplist. Those with libraries of clippings started to report problems accessing clippings made before about 2015, most probably because those from before that date had no file data, although in some cases this may be confounded by inadvertent removal of the old Resource fork, leaving the file devoid of all content.
Use in current macOS
To create any of these three file types, select the text you want to include in the clipping, drag it to a Finder window or the Desktop and drop it there. If the text contains an email address or web link, it will be saved automatically as a mailloc or webloc. Otherwise it will be saved as a textClipping titled using the first few words of its contents.
Clippings can be previewed in QuickLook by selecting them and pressing the Space bar. Although weblocs should open the page they link to, that may not work with existing weblocs in macOS Tahoe, although they can still be opened in Safari. Clippings can also be dragged and dropped into apps, particularly TextEdit, which should handle those created since 2015, and some from before that.
Perhaps the most curious way to access textClippings is in the Finder’s dedicated window, opened using its Open command or from the button of a QuickLook preview. This is useful in revealing the type of data contained in the textClipping, but can only be used to select and copy text from the textClipping, and can’t change it in any way.
Troubleshooting
Old clippings created before their contents were also saved in the file data (before 2015) are the most troublesome. Before going any further, check that they do still contain contents using the Finder’s Get Info dialog. By longstanding tradition, although file size excludes other extended attributes, it does include the size of any com.apple.ResourceFork xattr (formerly the Resource fork). If the current size of the clipping file is 0 bytes, then it no longer has any contents and can’t be recovered.
Clippings files that do still contain some contents should then be inspected to determined whether this is confined to the com.apple.ResourceFork xattr, indicating that they are old and recovery may be difficult. One way to do this is to drag and drop them onto my free Precize, which breaks down their contents into data and a total for extended attributes.
The following methods can be used to recover the contents of clippings:
- Select in the Finder, QuickLook preview using the Space bar, and Open to view in the Finder.
- Drag and drop into an empty document window in TextEdit.
- Open in BBEdit, or another good text editor.
If nothing else works, it’s still possible to recover contents of a com.apple.ResourceFork xattr using the DeRez command tool installed as part of Xcode. Download and install Xcode from the App Store first. To dump the entire contents of that xattr to a text file, use a command like
DeRez filename > outputfile.txt
or, to just dump contents stored as text, use
DeRez filename -only TEXT > outputfile.txt
where filename is the full path and name of the clipping file, and outputfile.txt is the destination for the contents. The text output isn’t pretty and requires extensive editing, but should recover the contents.
As with any other file in macOS, access to their contents may also be limited by Privacy & Security, through TCC and extended attributes including com.apple.macl.
Preventing problems
Collections of clippings containing items created before about 2015 should be revisited, and older items converted into the new format by dropping them into a new document, selecting their text, and dragging that out to create a new textClipping, webloc or mailloc that isn’t reliant on the com.apple.ResourceFork xattr.
I’m grateful to Sam for raising these questions.