Sub topic 5
Finding everything that shares a tag
This chapter assumes you can apply tags to files (covered earlier) and that you know where the Finder sidebar is. You don't need Terminal experience, but the last section uses two short commands.
Why a tag search works across folders
A tag is stored as metadata on the file, not as a folder location. Spotlight indexes that metadata, so Finder can list every tagged item on your Mac in one place, whatever folder it sits in. This is why you can tag files without moving them and still see them together.
Method 1: Click a tag in the sidebar
- Open any Finder window.
- In the sidebar, find the Tags section.
- Click a tag name, for example Red.
Finder shows every item that carries that tag. The window behaves like a search result, so you can still change the view, sort by column, or open the files directly.
If you don't see a tag you expect, it may be hidden in Finder Settings. A later chapter covers that setting.
Method 2: Search for the tag name
- Press Command-F in a Finder window, or click the search field.
- Type the tag name, such as
RedorClient A. - In the suggestions, choose the entry labelled with the tag (it shows a tag dot), not the plain text match.
- Check the scope buttons under the search field. This Mac searches everywhere. A folder name restricts the search to that folder.
The suggestion matters. Plain text search for Red also matches file names and contents that contain the word "red". The tag suggestion matches only the tag.
Tags with the same color
Tags that share a color are still separate tags. A tag named Red and a tag named Urgent may both show a red dot, but clicking Urgent lists only items tagged Urgent. If you expect to find both sets together, search for each tag, or give related items the same tag.
Method 3: Check with Terminal
Terminal queries the same index, so it is a useful way to confirm what Finder should show. First, read the tags on one file:
mdls -name kMDItemUserTags ~/Documents/report.pdfThen list every file under Documents with the tag Red:
mdfind -onlyin ~/Documents 'kMDItemUserTags == "Red"'The comparison is case-sensitive by default. To ignore case, add the c modifier after the closing quote, as in 'kMDItemUserTags == "red"c'.
Common errors
- Choosing the text match instead of the tag suggestion. You get extra results that only contain the word.
- A narrow search scope. The scope is set to one folder, so tagged files elsewhere are missed.
- Tag name typos.
Client AandClient A(two spaces) are different tags. - Files on volumes that Spotlight does not index. Some external or network drives are not indexed, so their tagged files may not show up.
Exercise
You tagged a PDF in Downloads with the tag Budget, but searching for Budget in a Finder window with the scope set to Documents does not show it. Give two ways to find it.
Show answer
Change the scope to This Mac so the search covers Downloads, or click the Budget tag in the sidebar, which lists tagged items from all indexed locations. In Terminal, mdfind 'kMDItemUserTags == "Budget"' also finds it.