Spotlight is the built-in search feature in Mac OS X El Capitan that lets you quickly find files, launch apps, and get information from the web. Sometimes it can misbehave—indexing issues, high CPU usage, or a search that returns no results—and turning it off and on again is a common fix. This guide walks you through disabling and re-enabling Spotlight from the command line, which forces a rebuild of its index and often resolves many problems.
What You’ll Need
- Administrator access to your Mac (you’ll need to enter your password).
- Basic comfort with the Terminal app—you’ll type a few commands.
- Time: the re-indexing process can take from a few minutes to several hours depending on your drive size.
Step-by-Step
- Save any open work and close all apps. While not strictly required, it’s a good practice to avoid any issues during the process.
- Open Terminal. Go to Applications > Utilities and double-click Terminal. You can also press Cmd + Space to open Spotlight, type “Terminal,” and hit Return.
- Turn off Spotlight indexing. In the Terminal window, type the following command and press Return:
sudo mdutil -a -i off
You’ll be prompted for your administrator password. Type it and press Return (you won’t see the characters as you type—that’s normal). This command disables indexing on all connected drives. - Verify that indexing is off. To confirm, run:
mdutil -a -s
You should see a message like Indexing disabled. for each drive. If you see an error, double-check the previous step. - Close Terminal. You can now quit Terminal (Cmd + Q).
- Restart your Mac. This clears any lingering Spotlight processes. Go to the Apple menu () and choose Restart….
- Turn Spotlight back on. After your Mac restarts, open Terminal again (same as step 2).
- Re-enable indexing. Type the following command and press Return:
sudo mdutil -a -i on
Enter your password again when prompted. - Force a full re-index. To ensure a clean rebuild of the index, run:
sudo mdutil -E /
This erases the current index on your startup disk and creates a new one. If you have external drives you also want to re-index, run the same command with their mount points, e.g.,sudo mdutil -E /Volumes/ExternalDrive. - Verify indexing is running. Check the status with:
mdutil -a -s
You should see Indexing enabled. and possibly Indexing… if it’s still building. - Wait for indexing to complete. Spotlight will now rebuild its index. You can continue using your Mac, but you may notice higher CPU usage and a slower search until it’s done. The time varies—a small SSD might take 15 minutes, a large hard drive could take hours.
- Test Spotlight. Once indexing is complete (you can check with
mdutil -s /—it should say Indexing complete.), press Cmd + Space and try a search. It should work normally.
Common Mistakes
- Not using sudo. The
mdutilcommands require administrator privileges. If you forgetsudo, you’ll get a “permission denied” error. - Typing the wrong drive path. When using
mdutil -E, make sure you use the correct path. The root drive is/, but external drives have paths like/Volumes/DriveName. You can list mounted drives withls /Volumes. - Interrupting the re-index. If you shut down or force quit during indexing, the index may become corrupted, and you’ll need to start over.
- Only turning off and on without erasing. If you just toggle indexing off and on without using
mdutil -E, Spotlight may not rebuild the index—it might just resume using the old (possibly corrupted) one.
Tips
- Use a single command to restart. You can combine the off, erase, and on steps into one line:
sudo mdutil -a -i off && sudo mdutil -E / && sudo mdutil -a -i on
This saves time, but you still need to restart your Mac in between to fully clear processes. - Monitor indexing progress. To see if indexing is still running, open Activity Monitor (in Utilities) and look for a process called mds or mdworker. If they’re active, indexing is in progress.
- Add privacy exclusions. If you have folders you never want indexed (e.g., a huge backup folder), you can add them to Spotlight’s Privacy list in System Preferences > Spotlight > Privacy. This can speed up future indexing.
Troubleshooting
- Spotlight still doesn’t work after re-indexing. Try resetting the Spotlight preferences. Delete the file
com.apple.spotlight.plistin~/Library/Preferences/and restart your Mac. This resets all Spotlight settings. - mdutil says “Indexing disabled” but Spotlight still shows results. This can happen if the indexing service is stuck. Try killing the processes manually:
sudo killall mds mdworker
Then restart your Mac and re-enable indexing. - You get an error like “Unable to turn off indexing.” This often means the drive is locked or has a hardware issue. Check the drive’s format (it should be Mac OS Extended or APFS) and run First Aid in Disk Utility.
- Re-indexing takes forever. If it’s been over 24 hours, there might be a corrupt file or a failing drive. Check the Console app for messages from mds or mdworker. Sometimes deleting the problematic file (if you can identify it) helps.
Frequently Asked Questions
Will turning off Spotlight delete any of my files?
No. Spotlight only creates an index (a database) of file metadata. Disabling or re-indexing does not touch your actual files.
Do I need to turn off Spotlight if it’s just slow?
Not necessarily. A slow Spotlight can often be fixed by simply re-indexing with sudo mdutil -E / without turning it off first. Try that first, and only do the full off/on cycle if it doesn’t help.
Can I turn off Spotlight permanently?
Yes, run sudo mdutil -a -i off and don’t turn it back on. However, you’ll lose the ability to search your Mac with Spotlight, and some apps that rely on it (like Mail’s search) may break.
What if I only want to exclude a specific folder?
You don’t need to disable Spotlight globally. Go to System Preferences > Spotlight > Privacy and add the folder to the list. It will be excluded from indexing.
Does this work on macOS Sierra or later?
Yes, the mdutil commands work on all modern macOS versions, though the menu names may differ slightly. The core process is the same.
How long does re-indexing take?
It depends on the size and speed of your drive. A typical 256GB SSD might take 15-30 minutes, while a 1TB hard drive could take several hours. You can keep using your Mac during this time.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- How to Cool Down an Overheating Laptop
- Good Password: How to Create One
- Remove Write Protection on External Hard Drive
- How to Disable Chkdsk at Windows Startup
- Restore WiFi and Secure Your Netgear Router After Reset
- Fix Error 0x80004005: Top Easy Ways That Work