Spotlight – Apple’s system-wide search engine – was introduced way back in 2005 when OS X 10.4 Tiger was released.
Spotlight is a system-wide desktop search feature of Apple’s OS X and iOS operating systems. Spotlight is a selection-based search system, which creates a virtual index of all items and files on the system.
Sometimes Spotlight doesn’t behave properly, or perhaps doesn’t know about files or folders that have just been created. Sometimes, it just forgets about files on external drives.And this is very annoying situation.For example, I saved a file with the name delegate in my documents and when I search it in the Spotlight it just doesn’t find it and returns the result as shown in the Pic- 31(b).
So when it does not work, you will need to rebuild the entire Spotlight index on your Mac.Here’s how to start the re-indexing process of an entire drive.
How to start the reindexing process of an entire drive
- Launch System Preferences from the Apple menu.
- Click on “Spotlight” and then click on the “Privacy” tab.
- Drag Macintosh HD (and other drives if necessary) into this window.
- After it is dragged to this privacy box a confirmation dialog box appears.
- Click “OK” when asked to confirm and wait for a minute.
- Now select the drive(s) you just added and click the “-” minus button to remove it from the list.and your Mac will create a new Spotlight Index.
This also works for external drives that aren’t indexing properly. Just drag them into the window, then remove them. To check on the progress just click the spotlight icon (magnifying glass) in the menu bar.
If this doesn’t initiate reindexing of the drive, you may need to initiate it manually through the command line.
Open Terminal from Applications/Utilities folder and use the following command string to rebuild the Spotlight index for your Mac.
sudo mdutil -E /
After pressing enter, you’ll be required to enter your password (because this command runs as a super user). After you do that, you will notice after a few minutes that when clicking the Spotlight button in the menu bar, Spotlight will show that it is currently indexing your system.
Next type the following command and hit return and type the password when asked.
sudo mdutil -i on /
Spotlight will begin building the index within a few minutes of issuing this command.Also note, that usually re-indexing Spotlight can take a while. it may take 30 minutes to an hour or two.
This terminal method can also be used to re-index specific external drives on your Mac. To do this all you need to do is modify the ending of the above code. I’ll give an example. I have an external drive called MyExtDrive. To re-index it in Spotlight I’d type in:
sudo mdutil -E /Volumes/MyExtDrive/
If you have an external drive you want to re-index, just replace the “MyExtDrive” part with the name of your drive.
Method 3 – Final Method when nothing works
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist