Spolight Privacy anomalies in Mac OS X 10.4

Under Mac® OS X 10.4, using Privacy to stop Spotlight® indexing can cause a variety of anomalous behaviors which are the result of inconsistencies in how the Privacy tab works vs. certain functions of the mdutil command.

The following anomalous interactions between Privacy and mdutil, whether bugs or undocumented effects, were found testing with Mac OS X 10.4:

  1. If you add a volume to Privacy while Spotlight is indexing that volume:
    1. Spotlight immediately stops indexing the volume.
    2. You will be unable to search that volume with Find (Finder > Command-F).
      1. Find is implemented in Spotlight and respects the settings specified in the Privacy tab of Spotlight Preferences.
      2. Adding a volume to Privacy creates the file _exclusions.plist in the volume's .Spotlight-V100 directory, with a setting specifying that the volume cannot be searched.
    3. Incomplete index files may remain in the volume's .Spotlight-V100 directory.
    4. The Spotlight indexing process may crash, leaving the file mds-crash-state in the volume's .Spotlight-V100 directory. This file appears to prevent Spotlight from indexing the volume again — even if the volume is removed from Privacy — until the volume's .Spotlight-V100 directory has been removed via the command:
      1. sudo rm -ri /path_to_volume/.Spotlight-V100
    5. where /path_to_volume is the path of the volume in question.
    6. The volume can then be reindexed by any of the following methods:
      1. Restarting your Mac.
      2. Using Disk Utility to first unmount, then mount the volume.
      3. Issuing the command: sudo mdutil -E /path_to_volume
  2. If you add a volume to Privacy after Spotlight has indexed that volume:
    1. As noted previously, you will be unable to search the volume with Find.
    2. Spotlight will no longer index the volume when its contents change. However, indexing is still enabled as can be shown by the command:
      1. sudo mdutil -s /path_to_volume
    3. The _exclusions.plist file, created when the volume was added to Privacy, prevents both searching the volume and subsequent indexing of that volume while it is listed in Privacy.
    4. The ContentIndex.db file is removed from the volume's .Spotlight-V100 directory.
    5. The metadata index file store.db in the volume's .Spotlight-V100 directory is reduced in size. Apparently, all metadata is removed from this file for files whose contents were included in the now-removed ContentIndex.db file.
    6. Attempting to remove the remaining index files on the volume using the command:
      1. sudo mdutil -E /path_to_volume
    7. has no effect.
  3. If you add a volume to Privacy and then disable indexing on that volume via the command:
    1. sudo mdutil -i off /path_to_volume
    2. The volume no longer appears in Privacy. If you attempt to add the volume to Privacy again, it will not appear in Privacy.
      1. The volume will again appear in Privacy if you enable indexing with the command:
        1. sudo mdutil -i on /path_to_volume
      2. Despite this command, indexing is still disabled on the volume: the setting in the _exclusions.plist file in the volume's .Spotlight-V100 directory, created when it was added to Privacy, continues to prohibit indexing.
      3. The general rule here is the following: you cannot add to Privacy any volume for which indexing has been disabled with the -i off flag of mdutil.
    3. The volume can be searched to some degree with both Spotlight and Find.
      1. Spotlight and Find ignore the setting in the _exclusions.plist file in the volume's .Spotlight-V100 directory, despite the fact that adding the volume to Privacy sets this file to indicate the volume cannot be searched.
      2. The results of a search using Spotlight or Find for a string, such as xyz, on the volume will be equivalent to the results from the UNIX® find command:
        1. find -x /path_to_volume -iname "*xyz*"
      3. with the exception that neither Spotlight nor Find will not search within application packages whereas UNIX find will, the latter depending on permissions.
      4. The general rule here is the following: disabling indexing on a volume with the -i off flag of mdutil after the volume has been added to Privacy enables the volume to be searched, to some degree, in both Spotlight and Find.
  4. The only way to remove all the index-related files after stopping indexing via Privacy is to use mdutil to both disable indexing on the volume and erase the index files. This is accomplished by issuing the following two commands in Terminal in the order specified:
    1. sudo mdutil -i off /path_to_volume
    2. sudo mdutil -E /path_to_volume
  5. While one may be tempted to combine both the -i off and -E flags in a single mdutil command, i.e.
    1. sudo mdutil -i off -E /path_to_volume
  6. we have seen mixed results from such: sometimes it works, sometimes it does not. Using the commands individually, in the order specified, works consistently.
  7. You will then also be able to search the volume with Find or Spotlight as noted item 3 above. Once again, any volume added to Privacy will no longer appear in Privacy after indexing has been disabled on that volume via the -i off flag of mdutil.

Related links

Did you find this FAQ helpful? You will find a wealth of additional advice for preventing or resolving Mac OS X problems in Dr. Smoke's book, Troubleshooting Mac® OS X.
Use of this site signifies your agreement to the terms of use.