How to Fix macOS Spotlight Not Indexing
In this tutorial, you'll learn about How to Fix macOS Spotlight Not Indexing. We cover key concepts, practical examples, and best practices.
The Problem
Spotlight search returns no results or only partial results:
No results found for "file i need"
Or:
Spotlight is still indexing. Results will appear when indexing is complete.
But the indexing never finishes. The Spotlight index is corrupted or stuck.
Quick Fix
Step 1: Check Spotlight privacy exclusions
- System Preferences > Spotlight > Search Privacy
- If your drive or folder is listed, select it and click -
- Wait 15 minutes for re-indexing to begin
Step 2: Rebuild the index via Terminal
sudo mdutil -E /
The -E flag erases the existing index and starts a fresh one. This affects the entire startup volume.
Step 3: Turn indexing off and on
sudo mdutil -i off /
sudo mdutil -E /
sudo mdutil -i on /
This stops, clears, and restarts indexing for the root volume.
Step 4: Check indexing status
mdutil -s /
Expected:
Indexing and searching enabled.
/ indexing enabled.
If it says "Indexing disabled," re-enable with sudo mdutil -i on /.
Step 5: Reset SPMetadata and Spotlight stores
sudo rm -rf /.Spotlight-V100
sudo rm -rf /System/Volumes/Data/.Spotlight-V100
These are the hidden index files. They are recreated automatically. Restart after deletion:
sudo mdutil -E /
Step 6: Remove and re-add folders to spotlight
# Add a folder to Spotlight's indexing list
sudo mdimport -i /Users/yourname/Documents
If specific folders are not indexed, this forces an immediate import.
Step 7: Verify file metadata is indexed
mdls ~/Documents/test.txt
If mdls returns no metadata attributes, the file is not indexed. Check that its parent folder is included in Spotlight's scope.
Step 8: Check for Time Machine interference
Time Machine backups can slow Spotlight indexing. Temporarily disable Time Machine:
sudo tmutil disable
Re-enable after indexing completes:
sudo tmutil enable
Step 9: Wait for initial indexing (new Mac)
First-time indexing on a new Mac with a large drive can take 24-48 hours. Ensure the Mac is plugged in and connected to Wi-Fi.
Prevention
- Keep the startup drive at least 15% free for indexing to work efficiently.
- Do not add the entire drive to the Privacy exclusion list.
- Restart periodically to clear indexing stuck states.
Common Mistakes with spotlight not indexing
- Forgetting
deriving (Show, Eq)on custom data types needed for debugging - Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable
- Using
headandtailinstead of pattern matching, causing runtime errors on empty lists
These mistakes appear frequently in real-world MACOS code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
Practice Exercise
Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
FAQ
DodaTech Tool Reference
Doda Browser's Unified Search uses its own indexing engine alongside Spotlight, providing instant file search even when Spotlight is rebuilding.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro