Spotlight search result incomplete

finderspotlight

Since I changed the directory structures of my Mac, Spotlight has not successfully produced search results for my files or folders.

I have tried

  1. Killing SystemUIServer
  2. Rebuilding the Spotlight Index manually using sudo mdutil -E /
  3. Changing Desktop Resolution

  4. Clear caches and preferences using downloaded application
  5. Rebooting Mac

All suggested in this to no effect. 4th item was recommended against on Apple Support Community. And of course, I tried what was suggested by seaturtle.. reindexing Macintosh HD.

Using terminal with the right keywords, the files/folders come up, but I would like to fix permanently.

Has anyone got other idea? Kindly let me know.

  • I currently use Macbook Pro of 2012, OS: High Sierra 10.13.2

Best Answer

Can you wait for Spotlight to reindex your machine?

If so, try this:

  • Go to the Spotlight section of System Preferences.
  • Go to the Privacy section and add your boot disk (mine is Macintosh HD).
  • Remove it again.
  • Go to Spotlight. Notice the "Indexing..." indicator. You can continue to use Spotlight and the rest of your machine while it indexes, but until it finishes it may not find everything.

Can't wait (or don't want to use Spotlight)?

Try this Terminal command to search by name. Any 's should be replaced with '\'', because otherwise they would end the quoted string.

find ~ -iname '*whatever*'

Searching by file contents is trickier, and will only work for plain text files. Try this:

grep -iRIl 'whatever' ~

What does this all mean?

  • ~ – your home folder
  • -iname – tells find to do a case-insensitive search by filename
  • 'xyz' – single quotes prevent characters like Space, ( or ), etc. from being interpreted by the shell
  • *whatever* – the *s mean "any number of characters can go here". Otherwise, find would only search for files named exactly "whatever".
  • -iRIl:
    • -i – case-insensitive
    • -R – recursive (search subfolders too)
    • -I – ignore files that aren't plain text
    • -l – list files, but don't display matching lines