Spotlight in Finder excludes system-related directories by default.
Use mdfind
in Terminal to check if it is actually found by Spotlight, but just excluded from Finder's "user-friendly" results:
$ mdfind foo
/private/var/db/foo
Needless to say, /private/var/db
is excluded from Spotlight search results when searching using the GUI
Make sure the volume your file is on is included in Spotlight. Check the Spotlight preference pane's exclusions, and mdutil -s mountpoint
, e.g. mdutil -s /
for the system disk:
$ mdutil -s /
/:
Indexing enabled.
You can enable displaying system files by selecting the criteria dropdown (where you select Kind etc.), then Other…. Search for System files, and check it to have it appear in the dropdown list. Whenever you search for system-related files, or want them included, make sure you add this criterion and select are included.
![enter image description here](../../I/static/images/4421bdc00ac05ff2c9790b84f177c523438b30cff0f97206f34f57c4538d9a45.png)
Alternatively, you can also use mdutil
from the command-line, or a third party UI to it without filtering (HoudahSpot comes to mind, but I haven't used it), or use the locate
command-line tool (and perhaps a GUI for it) once you initialize it using the instructions printed when it's not.