27

I've heard it is possible to add tags to a file's meta data in OS X, and have Spotlight search through such tags.

  1. In a nutshell, how would one access this feature in Finder – not Spotlight (Command+Space) – but the adding of tags themselves?

  2. Where are these tags stored? Do they go in .DS_Store (I tend to delete those!) or elsewhere in the filesystem?

  3. Does this tagging mechanism work on removable drives? What are the requirements?

  4. Does this tagging mechanism work over a network share? I have some Windows SMB network shares at home that I frequently store files on. Would it work on those or is another configuration required?

  5. Aside from Spotlight, are there any command-line tools for searching through or accessing the tag data for files?

Thank you!

1 Answer 1

16

In a nutshell, how would one access this feature in Finder – not Spotlight (Command+Space) – but the adding of tags themselves?

From Finder, highlight a file and hit Cmd-I (or right click and select Get Info) to bring up the File Info Dialog for the file. In this dialog, the Spotlight Comments field is where you add tag data. Just add text to this field to "tag" the file.

Here's a good article on how to become a meta-data wizard in OS X:
https://gigaom.com/2007/02/01/using-metadata-effectively-in-os-x/

Tagging your documents

If was tagging that screen capture, I might use the following in the comments box:

customer-name presentation product-name

So that I could find that screen shot by the customer, or by the fact that it's being used in a presentation, or by the name of the product I'm showing them.

Where are these tags stored? Do they go in .DS_Store (I tend to delete those!) or elsewhere in the filesystem?

Yes, they're stored in the .DS_Store files you see in each folder. These files are read by Finder. The information is also stored in Extended Attributes (EAs) on the files themselves. Spotlight will prefer to read the data from EAs. EAs are a feature of the HFS+ filesystem, so remote filesystems might not necessarily have EAs available on files. In these cases, .DS_Store files are the fallback. Spotlight would also have a tag <-> file mapping section in its database but that's only accessible to Spotlight.

Does this tagging mechanism work on removable drives? What are the requirements?

Generally: yes. You can add tags to files and folders on removable drives and remote shares. Unless you've turned off .DS_Store creation on remote shares, OS X will just add these files and keep the meta-data there for you.

Does this tagging mechanism work over a network share? I have some Windows SMB network shares at home that I frequently store files on. Would it work on those or is another configuration required?

Yes, see above. If you didn't want OS X to do this, run:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

And then restart Finder.

Aside from Spotlight, are there any command-line tools for searching through or accessing the tag data for files?

Lots!

Here's a list of 7 file-tagging applications for OS X: http://mac.appstorm.net/roundups/utilities-roundups/7-file-tagging-applications-for-os-x/

I personally love and use LaunchBar which is like Spotlight on steroids.

4
  • A down vote from me because the modern approach to tagging uses extended attributes (EAs). The list of seven applications, linked from this answer, mentions OpenMeta; OpenMeta uses EAs. Jul 26, 2015 at 11:51
  • @GrahamPerrin note that the data is stored in both the EAs on the files and the .DS_Store. Finder reads DS_Store, Spotlight reads EAs apparently, but they would only be available on HFS+ file systems: apple.stackexchange.com/questions/64412/… -- I've modified the answer to make this clear.
    – Ian C.
    Jul 26, 2015 at 18:17
  • 1
    Please see chat.stackexchange.com/transcript/message/23022103#23022103 and nearby; EA-based tagging is not limited to HFS Plus, and so on. The multiplicity/variety of questions in apple.stackexchange.com/q/46614/8546 above, plus the tagging-related changes in OS X 10.9 and beyond, plus the bugs that affect tagging in some environments, and more, make it potentially difficult to arrive at a single, comprehensive answer here … Aug 2, 2015 at 8:44
  • @IanC. what if there's a mismatch between what's in .DS_Store and the EAs? Say, I connected the drive to a Windows computer and moved or renamed a file. The EAs are still there, but .DS_Store no longer contains info about it. What if I removed .DS_Store altogether? Mar 13, 2022 at 14:38

You must log in to answer this question.

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