Remove stubborn Spotlight privacy items in OS X

Unlike other services, Spotlight settings are located in special hidden folders.

The Spotlight search technology in OS X will index the entire drive for inclusion in search results, but also has options where you can enable or disable specific file types to tailor the search results for your needs. In addition, Apple provides a privacy list where you can add folders or even entire drives to prevent the contents within them from being indexed and included in search results. While adding and removing items from this list is usually relatively painless, there are times when you cannot seem to modify the spotlight settings.

Recently I was contacted by MacFixIt reader Dean F., who wrote in with such a problem:

I have a MacBookPro 17" circa 2010 running Lion 10.7.3. Every time the computer is restarted, the boot drive is added to Spotlight Privacy List, thus disabling indexing. I can remove it, indexing begins, login and out as other users and all is OK. But when the system restarts, the drive appears in the list again. I have done everything I know, delete user ACL, clear caches, reinstalled Lion, and still the problem continues.

Spotlight feature in OS X is a full system indexing technology that Apple uses in OS X in place of conventional find operations. Instead of traversing the hard drive and checking each file when instructed to locate results for a search query, the system maintains an index of all the files on the system and their contents, which it uses to quickly find the search term.

Spotlight Privacy list
Any items in the Spotlight Privacy list will not be indexed. Screenshot by Topher Kessler

When Spotlight indexes a drive, it saves the index store to a hidden folder at the root of the file system, along with a volume configuration file for the drive. The configuration file is a property list that contains characteristics about the drive, and also contains the options that spotlight uses to determine how to index the drive. When you add a folder to the Privacy list in the Spotlight preferences, the configuration file for the volume on which that folder resides is updated to contain the folder's path as an Exclusion entry (in older versions of OS X the exclusions are stored in a separate Exclusions file). With this setting, when you attach the drive the Spotlight service will update the index but avoid the items in the exclusions list.

Since the exclusions are an entry in the volume configuration property list, you can remove any stubborn ones by simply deleting the Exclusions entry from this list. To do so, open the Terminal utility (located in the /Applications/Utilities/ folder) and run the following command:

sudo defaults delete /.Spotlight-V100/VolumeConfiguration Exclusions

In OS X versions prior to Lion you may have a separate Exclusions.plist file where the exclusions are kept, which can be deleted by running the following command:

sudo rm /.Spotlight-V100/Store-V1/Exclusions.plist

After these commands are run, you should find that any items in the Privacy list that were originally on the boot drive will no longer be included.

If for some reason Spotlight is still not behaving properly and will not store other settings, then you can force the system to rebuild the index and all settings from scratch by deleting the Spotlight index folder in its entirety, which can be done with the following command (be sure when you run this command that there is no space following the slash character):

sudo rm -rf /.Spotlight-V100

With this command run, open the Spotlight settings and ensure they are as you would like, and then the system should create fresh configuration files for Spotlight and begin indexing the drive again.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments
    Latest Galleries from CNET
    Tech industry's high-flying 2014
    Uber's tumultuous ups and downs in 2014 (pictures)
    The best and worst quotes of 2014 (pictures)
    A roomy range from LG (pictures)
    This plain GE range has all of the essentials (pictures)
    Sony's 'Interview' heard 'round the world (pictures)