Sub topic 9
Choosing what Spotlight shows and excluding folders
This chapter assumes you can open Spotlight with Command-Space, launch apps from it, and find your way around System Settings. You should also know what the Spotlight index is. It is the database macOS builds from your files and their metadata, and Spotlight searches the index instead of scanning the disk each time. Here you will learn to control which kinds of results appear and which folders Spotlight ignores.
Why tune Spotlight
Spotlight searches many sources by default: apps, documents, mail, messages, contacts, web suggestions, and more. That breadth is helpful until it gets in the way. Common reasons to adjust it:
- Results from categories you never use push the file you want down the list.
- Folders full of generated files, such as build output or caches, clutter every search.
- Some folders hold private material that you do not want to show up in a search, even on your own screen.
- Indexing a very large folder uses CPU time and disk activity that you would rather avoid.
There are two separate controls. One decides which result categories are shown. The other decides which locations are never searched. Both are in System Settings.
Opening the settings
Menu names differ a little between macOS versions. The steps below match recent releases (macOS Ventura 13 and later).
- Open the Apple menu and choose System Settings.
- Choose Spotlight in the sidebar. On some versions it is under Siri & Spotlight.
- You will see a list of result categories and a button labeled Search Privacy.
Choosing result categories
The category list has a switch for each type of result. Typical entries include:
| Category | What it contains |
|---|---|
| Applications | Apps in the Applications folders |
| Contacts | People from the Contacts app |
| Documents | Word processing files, PDFs, text files |
| Folders | Folder names |
| Messages | Conversations in Messages |
| Mail & Messages | Email and chat content |
| System Settings | Panes in System Settings |
| Siri Suggestions | Suggested apps and content |
| Websites | Web results and Safari suggestions |
The exact list varies by macOS version and by which apps you have installed.
Turning a category off removes it from Spotlight results. It does not delete anything and does not stop the data from being indexed on older versions. The category simply stops being displayed. You can turn it back on at any time and the results return.
A worked example
Suppose you search for "budget" and the top results are web suggestions and Siri Suggestions, with your spreadsheet far down the list. To fix this:
- Open System Settings and choose Spotlight.
- Turn off Siri Suggestions and Websites.
- Press Command-Space and search for "budget" again.
The spreadsheet now appears near the top because fewer categories compete with it.
Excluding folders with Search Privacy
Search Privacy is the list of locations Spotlight must not search. Anything you add to it is left out of results, and Spotlight stops indexing it.
To add a folder:
- In the Spotlight pane, click Search Privacy.
- Click the plus (+) button, or drag a folder from Finder into the list.
- Choose the folder and confirm.
- Click Done.
To remove an exclusion, select the folder in the list, click the minus (−) button, and click Done. Spotlight then indexes the folder again. For a large folder this can take a while, and fans or battery use may rise until it finishes.
What gets excluded
An exclusion applies to the folder and everything inside it, including subfolders. You can also exclude a whole disk, such as an external drive or a backup volume. This is a common use, because Time Machine backup volumes and big archive disks add a lot of indexing work and few useful results.
Good candidates for exclusion
- Build and dependency folders, such as
node_modulesor compiled output, which contain thousands of files you never search for by name. - Cache and temporary folders.
- Virtual machine disk images and large media scratch folders.
- Folders with sensitive documents, if you do not want them surfacing in a shared screen or demo.
Checking that an exclusion works
After you add a folder, test it. Put a distinctive word in a file inside the folder, for example a text file containing zebra-lantern-91. Search for that word in Spotlight. The file should not appear.
You can also check from Terminal. The command below asks the index for files containing that word under your home folder:
mdfind -onlyin ~ "zebra-lantern-91"An excluded file returns nothing. If the file still appears, check that you excluded the correct folder and that you clicked Done to save the change.
How exclusions differ from other privacy options
Search Privacy is not a security feature. It hides items from search results but does not encrypt them or restrict who can open them. Anyone with access to your account can still browse to the folder in Finder.
Some related behaviors are worth knowing:
- Files on a volume with indexing disabled are not searchable by Spotlight at all. You can check a volume with
mdutil -s /. - Metadata that is already in the index may remain until the index is rebuilt. Adding an exclusion normally removes items, but if you see stale entries, a rebuild clears them (covered in the troubleshooting chapter).
- Excluding a folder does not hide an app inside it from the Applications category unless the app is within that folder.
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| A file you want does not appear | It is inside an excluded folder, or its category is off | Check Search Privacy and the category switches |
| A folder is still searchable after exclusion | The change was not saved, or a different copy of the folder is being found | Reopen Search Privacy and confirm; click Done |
| Results disappeared for a whole drive | The drive was added to Search Privacy | Remove it from the list |
| A category you turned off still shows items | You are searching in Finder, which uses its own scope | Finder searches do not follow the Spotlight category switches |
The last row matters. Category switches change the Spotlight window only. A search in a Finder window, covered in a later chapter, looks at files directly and is limited by Search Privacy but not by the category list.
Summary of the decision
Use categories to control what you see. Use Search Privacy to control what is searched. If a result is merely noisy, turn off its category. If a location should never be searched or indexed, exclude it.
Exercise
You search for "invoice" and see many web suggestions above your files. Separately, a folder named build-output slows indexing and fills results with irrelevant names. Which setting do you change for each problem, and does either change delete any files?
Show answer
For the web suggestions, turn off the Websites (and, if present, Siri Suggestions) category in the Spotlight pane of System Settings. For build-output, add the folder to Search Privacy. Neither change deletes files. Category switches only hide results, and Search Privacy only stops Spotlight from searching and indexing the folder.
Exercise
You excluded ~/Projects/archive and then ran mdfind -onlyin ~ "zebra-lantern-91" for a word that exists only in a file in that folder. The command still prints the file's path. List two things to check.
Show answer
First, confirm the correct folder is in the Search Privacy list and that you clicked Done so the change was saved. Second, check whether the index holds stale data. If it does, rebuild it with sudo mdutil -E / and test again after indexing finishes. A second copy of the file in a non-excluded folder is also worth checking.