Are Finder Tags useful metadata?
Finder tags offer a simple and accessible way of adding metadata to your files and folders. But before you rush off and start tagging everything on your Mac, allow me to explain how to get the best out of them, and what their limitations are.
Using tags
Finder tags are exposed to the user in the Finder, where they’re the most accessible metadata of all. They merit their own section in the Finder’s Settings, where you’ll find simple but powerful tools for their use and customisation.
Each tag consists of two elements: a colour which can be none or chosen from the fixed range of seven (red, orange, yellow, green, blue, purple, and grey), together with a text label. When you use the standard macOS tags, their text labels are simply those colour names; change those labels in the Finder’s Settings by Control-clicking on them, or with two slow clicks on their name just as when renaming a file.
Adding a new tag is obvious, by clicking on the + tool at the foot of the tag list, and clicking on the – tool there removes the selected tag.
The extended attribute that stores a tag contains both elements of each of its tags, and can hold multiple tags. When you add your own custom tags, items marked by them have an extended attribute attached containing the label of your custom tag and its set colour, from the range of seven plus no colour.
If you want, you can assign the same colour to multiple text labels, for example both Urgent and Important to red. However, most find that confusing, as the only way to see which text label is associated with a red tag is to Get Info on that file, where it’s shown in the uppermost section of the dialog. In practice, this confines you to using no more than seven text labels, one for each of the standard colours.
The Finder manages tags for you. For example, if you customise one of the standard tags by changing its name, say from Red to Urgent, then the Finder automatically changes all items marked with that tag to show the label Urgent. That tag remains associated with that file or folder: when you copy it across to another Mac, the tag remains attached, and on that second system should continue to show the same colour and label. This also applies to any custom tags you add.
The important exception to this is if the item is moved using a method which doesn’t preserve its metadata (extended attributes), which occurs on some file systems such as NFS, and using some command line tools. Some backup methods may also not preserve metadata, and will strip all your tags; Time Machine preserves them all.
Tags are widely supported in the Finder, macOS tools, and apps. When you show tags in the Finder’s sidebar, you can view items with only a specific tag by selecting that tag in the sidebar of a Finder window. The same feature works in file open and save dialogs in all apps using the standard macOS dialog too. You can further refine a tag-based listing by opting to sort those files in date or other orders, and you can group by tags too.
There are several different ways to assign one or more tags to any file or folder, and you can use the same methods to remove tags. The simplest is probably using the Finder’s contextual menu. Note that if you remove a tag from the list in the Finder’s Settings, that tag is also removed from every item tagged with it. You can use that to your advantage if you use a custom tag to work on a specific project: when that’s complete, and the documents are archived, search for any outlying items that still have that tag, then delete the tag in Finder Settings once you have cleared them away.
Scripting
You can tag files automatically in shell scripts, AppleScript, and many other languages supported on macOS. If you want to do this, one easy approach has been to install tag, available in Homebrew and MacPorts, or from its Github site, although it hasn’t been updated for several years.
Spotlight
Finder tags can also be used as a criterion in Spotlight searches, although those are based not on the tag colour but its text, such as Important for a red tag labelled Important. You’ll need to add the Tags item to the Finder’s list of search criteria before you can use it to find items in the Finder.
Extended attribute
Finder tags are stored in extended attributes of type com.apple.metadata:_kMDItemUserTags. They consist of a binary property list containing a little UTF-8 text. This is an NSArray consisting of Strings, each containing a tag name, followed by the newline character, followed by the colour number (0-7). The array can be empty.
Colour numbers used are:
none, 0
grey, 1
green, 2
purple, 3
blue, 4
yellow, 5
red, 6
orange, 7.
Thus a tag name might read Redn6, or Orangen7 Greenn2 for two colours, where n represents the newline character 0a.
When the Finder writes a tag extended attribute to an item, it also adds a null com.apple.FinderInfo xattr of 32 bytes length, if that isn’t already present.
Limitations
Unlike many types of metadata, Finder tags are a closed system giving you just seven different visible tag colours, for seven text labels. While you can use those in combination, you can’t extend the range of visually different tags. Other metadata like keywords are open-ended: you can add any keyword you like, and macOS doesn’t constrain you from using hundreds, but you won’t see those keywords as readily in the Finder.
If you only have a handful of different categories that you want to tag files and folders with, Finder tags should prove ideal. For example, if you want to classify your photos into no more than seven categories, such as social, travel, parties, and so on, they’ll work well with tags. If you want to add the names of people in each image, or their locations, then tags are the wrong type of metadata to do that. Another example is tagging projects: if you need no more than seven different project tags, then Finder tags should serve well. If you need a dozen or more, then they’ll quickly prove inadequate.
Happy tagging!