Spotlight is the powerful search engine built directly into macOS (accessed by pressing Command + Space). It maintains a massive, hidden database that indexes every single word within your documents, emails, and applications. However, if your Mac crashes unexpectedly or you clone your hard drive to a new SSD, this database can become severely corrupted.
When the index breaks, pressing Command + Space and typing the name of an application might yield zero results, or worse, searching for “System Settings” might open an irrelevant text file from three years ago. When the graphical interface fails to rebuild the search index cleanly, you must use a powerful Terminal command to forcefully wipe the hidden database and command macOS to start over.
How to Manually Force a Mac Spotlight Reindex via Terminal
You must use the mdutil (Metadata Utility) command to interact directly with the Spotlight indexing daemon.
- Open the Finder, go to Applications, open the Utilities folder, and double-click Terminal (or press Command + Space and search for Terminal).
- First, you must completely disable the Spotlight indexing service for your primary hard drive. Type the following command and press Enter:
sudo mdutil -i off / - Because this is a core system command, you will be prompted for your administrator password. Type it in (the characters will remain invisible) and press Enter.
- Next, you must forcefully delete the corrupted physical database stored on your SSD. Type this command and press Enter:
sudo mdutil -E / - The Terminal will confirm that the volume has been completely erased.
- Finally, you must turn the indexing service back on so macOS can begin rebuilding the database from scratch. Type this command and press Enter:
sudo mdutil -i on /
If you press Command + Space immediately after running these commands and start typing, you will see a progress bar stating “Indexing…” Depending on how many files you have on your Mac, this process can take several hours to complete. Once finished, your Spotlight searches will be lightning-fast and perfectly accurate again.