craftwa.re

A walk outside the sandbox

Home Blog Cheat Sheets MacOS Tips Area 51 About

Spotlight Disable Indexing

|

Overview

The previous tip covered the way Spotlight works. A very little documented feature of Spotlight, but one that can be very useful, is the possibility to disable indexing for specific sensitive folders. By default, indexing will be performed immediately after file notifications are received by the mds daemon:

spotlight-indexed

  • GUI - Using the interface, got to System Preferences → Spotlight → Privacy and add your desired folder to the list:

spotlight-noindex

  • Manual - Previously, you could create a file named .metadata_never_index in the folder you wanted to prevent indexing, but currently this trick no longer works. However, the following works fine with macOS Sierra to prevent a specific folder or file from being indexed by Spotlight. Simply add a “.noindex” extension and the folder will be removed from the database and not indexed in the future.

Note: The manual method works only with folders and files, not with whole drives.