May 4, 2018

Spotlight in MacOS High Sierra

There have been reported problems with how Spotlight search is working on the latest version of MacOS (High Sierra). For some people it isn't working or that it's slowing down their computer.

Apple Spotlight

Clearing the Spotlight Database

According to Apple, the best way to zero out the Spotlight Database is to put the drive in the Privacy section of Spotlight. When you do this, Spotlight will remove all information relevant to that location.

Steps to "Officially" Clean out Spotlight

  1. Go to 'System Preferences' then select Spotlight icon
  2. Select the Privacy Tab
  3. Click on the '+'
  4. On the left scroll down Devices and click on computer name, then select your hard drive, probably named 'Macintosh HD'

Once that is done, you remove the entry from Privacy and then Spotlight will reindex the data from scratch - like it didn't know it existed. I would recommend waiting a few minutes for the database to get cleared.

Steps to "Officially" ReIndex Spotlight

  1. Go to 'System Preferences' then select Spotlight icon
  2. Select the Privacy Tab
  3. Click on the item in the Privacy menu - probably 'Macintosh HD'
  4. Click the '-' just below the list of Privacy items.
  5. Close out the 'System Preferences' window

Obviously the index is going to take some time to work. The amount of time that it takes will depend on the size of your data and what you have set to Index in the Spotlight Control panel. Your better off letting this run overnight so that indexing process isn't flighting resources with other computer activity.

Using MDUTIL Services

If Apple's official way doesn't work then try the mdutil way...

The mdutil command is at your service. The command manages the database used by Spotlight. If you're doing anything with Spotlight, you have to go through the mdutil command.

Some of these commands you need to be the computer root user. Which for most instances, the primary user that logs into the computer.

Check the Status of Spotlight

The mdutil -s command checks to see if Spotlight Index is on. That is will search inquiries return a search results.

mdutil -s /

Two Responses you can get:

  • Indexing enabled. This meeans that Spotlight Index is on.
  • Indexing disabled. This meeans that Spotlight Index is off.

Alternative Way to Erase and Rebuild the Database

Using the 'E' flag with running mdutil will Erase and Rebuild the Index. The same caveat as before, it will take some time for the index to get rebuild.

mdutil -E /

Stopping Spotlight Services

This is useful Spotlight indexing is taking too much of your computer resources.

mdutil -i off /

This is what you should see if the process was successful.

mdutil[96409:6557235] mdutil disabling Spotlight: / -> kMDConfigSearchLevelFSSearchOnly
Indexing disabled.

Restarting Spotlight Services

If you're not going to use the computer for a while, why not turn on indexing. Remember you can always exclude documents and folders by using the Spotlight Control panel.

sudo mdutil -i on /

This is what you should see if the process was successful.

/:
Indexing enabled.

Things I learned

  • Spotlight handles the Smart Mailboxes in Apple Mail. So when you rebuild, it will take a while for the Smart Mailboxes to show current data.
  • One of the new features of High Sierra is that Spotlight now can show flight status information. You can disable this feature by unchecking 'Spotlight Suggestions' in the Spotlight Control Panel. (So if you're having Spotlight issues after upgrading to High Sierra, certainly turn off the 'Spotlight Suggestions' to see if it helps.)

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!