Clearing Spotlight Cache in Mac OSX
The mdutil program in OS X can be used to clear out the metadata store that Spotlight uses. The metadata store is located in the /.Spotlight directory.
I had a problem with Spotlight where it started to behave erratically. Clearing out the metadata store fixed the issue. To clear the metadata store, you need to use sudo or become root. Additionally, the mdutil command requires that you specify a volume to operate on. Your primary volume is ‘/’. Other volumes, such as thumb drives, can be specified by their mount point.
- To display the status of indexing
# mdutil -s /
- To clear the metadata store
Turn indexing off for /
# mdutil -i off /
Clear the metadata store for /
# mdutil -E /
Turn indexing back on for /
# mdutil -i on /
When you clear the store and turn the indexing back on, it will take a while for the system to re-index the files and programs that you have installed.