sudo mdutil -E / sudo mdutil -i on /
This will reindex every mounted volume on the Mac, including hard drives, disk images, external drives, etc. Specific drives can be chosen by pointing to them in /Volumes/, to only rebuild the primary Macintosh HD:
sudo mdutil -E /Volumes/Macintosh\ HD/
To reindex an external drive named “External” the command would be:
sudo mdutil -E /Volumes/External/
Individually Reindexing Selected Files
In rare cases, Spotlight can miss a file during index, so rather than reindex an entire drive you can also manually add an individual file to the search index with the mdimport command:
mdimport /path/to/file
