Manage the metadata stores used by Spotlight.
Syntax mdutil [-pEsav] [-i on | off] volume ... Key -E This flag will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate (if they contain files). -i on | off Set the indexing status for the provided volumes to on or off. Note that indexing can be delayed due to low disk space or other conditions. -p Purge network cache. Spotlight caches indexes of some network devices locally. This option requests that all local caches be flushed to the appropriate network device. -s Display the indexing status of the listed volumes. -a Apply command to all volumes. -v Print verbose information when available.
To get a list of the available attributes for use in constructing queries, see mdimport(1), particularly the -X switch.
Show the indexing status of the root volume:
$ mdutil -s /
Erase and rebuild the spotlight index, this will often fix missing metadata in Finder after an OS upgrade:
$ mdutil -E /
Prevent spotlight from indexing all devices:
$ sudo mdutil -a -i off
“After all these years, I am still involved in the process of self-discovery. It's better to explore life and make mistakes than to play it safe. Mistakes are part of the dues one pays for a full life” ~ Sophia Loren
find - Search for files that meet a desired criteria.
mdfind - Spotlight search.
mdimport - Import file hierarchies into the Spotlight datastore.
mdls - List the metadata attributes for a specified file.
HT201716 - Rebuild the Spotlight index (System Preferences ➞ Spotlight ➞ Privacy).