There seems to be some confusion as to what metadata is, and where it is stored. This article looks at some of the most commonly-encountered metadata associated with Mac documents, explains where it is stored, and how it can be altered.
Metadata means information about the data in a document, as opposed to the content of the document itself. It can be very simple: a plain text file can have attached metadata containing details of the author, and inevitably has basic file attributes such as the date that it was created. Although the author information can be embedded in the text itself, when it is attached as a separate piece of information, it becomes metadata.
The best place to start examining metadata is in the Finder’s Get Info dialog, which provides the most ready access to much of the metadata for each file. I’ll take that dialog from the top.
The filename and its extension are the most fundamental attributes of a file, and key metadata. Classic Mac OS didn’t use extensions (or, rather, they didn’t mean anything to it, as it typed files according to the Finder Info), and there is still resistance from some users. Extensions don’t have to be MS-DOS-style and limited to three characters. If you want to make full use of macOS, use extensions such as .text which are helpful to the system and meaningful to humans.
Below the name, size, and datestamp of last modification, macOS shows any Finder Tags. These can be very useful metadata which you can customise, and control in the Finder. I have explained here how they work, using extended attributes. Indeed, they are the only extended attribute over which the user is given complete control.
macOS has many more standard attributes to display, and most of the more important ones follow in the General section.
The next extended attribute is found in More Info, where the Where from entry is taken from the extended attribute of type com.apple.metadata:kMDItemWhereFroms
. Although displayed here, when present, it is not controlled by the user in the way that Finder Tags are, but attached to downloaded files by the app or service which downloads them. Once present, there is no simple way for the user to remove it.
The Finder may instead show another extended attribute in More Info if there is no com.apple.metadata:kMDItemWhereFroms
attribute. One which it will display in such cases are the keywords stored in com.apple.metadata:kMDItemKeywords
if present.
The Last opened datestamp is particularly useful, but is not quite correct. Services such as Quick Look and the Finder itself can peek inside files to obtain metadata and similar information without their being recorded as opening the file. So this date and time represent the moment that a user-controlled app or similar opened them. It is not an extended attribute, but part of the normal macOS attributes for files.
Finder Comments are under user control, being displayed and edited here, in the Get Info dialog. Although macOS stores the text in an extended attribute of type com.apple.metadata:kMDItemFinderComment
, the comments themselves now appear to be stored centrally, perhaps in a Finder database. The Finder keeps the extended attribute and its central store in sync, when you move the file elsewhere its extended attribute may be preserved, but the Finder Comment lost, as it is not usually added to the local store of the destination.
This rather unexpected behaviour makes Finder Comments rather too ephemeral for most day-to-day uses.
File-specific settings for the default app of a document are stored in an extended attribute of type com.apple.LaunchServices.OpenWith
, but defaults are maintained by macOS Launch Services.
Where possible, larger images of documents are displayed using a thumbnail created by Quick Look, and reflect the content of the document, or show a front page with a tool to play media such as audio and movies. Those previews are managed by Quick Look, and are not stored in metadata.
Where a smaller image is required, the document icon is used, according to a system of priorities:
- If there is an extended attribute of type
com.apple.ResourceFork
containing an image thumbnail, that is shown as a document-specific icon. - If there is an established type-specific icon known to the Finder for that document type, that is shown as a type-specific icon.
- If there is nothing of higher priority, a blank document icon will be displayed as the default.
Creating document-specific thumbnail resources is complex and tedious. It is usually far simpler to copy and paste a suitable image into the top left icon position in the Get Info dialog if you want to do this, and let the Finder create the extended attribute for you.
At the foot of the Get Info dialog are the permissions settings, which are part of the standard attributes of every file and folder.
Opening customised documents using xattred shows the five most common Finder-related extended attributes, of
com.apple.FinderInfo
, which sets some general flags for Finder, and can be used to assign a single Finder Tag;com.apple.metadata:_kMDItemUserTags
, which contains Finder Tag settings;com.apple.metadata:kMDItemDownloadedDate
, which contains the datestamp for when this item was downloaded;com.apple.metadata:kMDItemFinderComment
, which contains the text from the Finder Comment but does not actually set it;com.apple.metadata:kMDItemWhereFroms
, which contains the URL of the location from which the item was downloaded;com.apple.quarantine
, which forms the quarantine flag to determine if Gatekeeper should perform a full check when an app is first run.
Standard media documents contain additional metadata specific to the type of document.
Standard still image formats, such as JPEG, may contain one or more defined sets of metadata, which will be extracted and displayed in the More Info section. These are not stored in extended attributes, but in the data of the document itself.
The same applies to standard audio formats…
…and standard movie/video formats. As for still images, these metadata are embedded in the document’s data, and not in extended attributes. That is to ensure that they are generally accessible across different platforms and file systems. They are also essential to be able to open and use the media content of the file.
Some other document types also include accessible metadata within their data. A good example are the metadata fields in Acrobat PDF files, which are displayed in the More Info section of the Get Info dialog.
Such content-specific metadata are displayed in full, and where possible can be edited, in apps which work with that type of content. Thus GraphicConverter and other image editors let you add, edit, and remove various image metadata.
This leaves another 140 different types of extended attribute which contain metadata which is not shown in the Get Info dialog. These are not secret by any means – many are custom metadata used by specific apps – and all are accessible from Terminal’s command line using the xattr
tool, or in xattred.
Contrary to some claims that I have seen recently, those extended attributes have long been well-respected by the majority of file systems, particularly Apple’s old HFS+ and new APFS. macOS also incorporates mechanisms for preserving them on other file systems, such as FAT variants commonly used on USB ‘thumb’ drives.
Indeed, as they are generally unseen and not removed, a little browsing of the extended attributes on most Macs reveals a treasure-trove of metadata which is extremely tenacious. Unless you deliberately go out of your way to remove it, it usually hangs on for years. Unless, of course, you transit files through iCloud Drive.