Don’t know why but sometimes upgrading between various OSX versions say from OS X10.7 to OSX 10.8 Mountain Lion or from X10.8 to OSX 10.9 Mavericks, the searching and indexing application Spotlight seems to be on steriods, constantly having that little magnifying glass glowing at me, taunting me, teasing me. Fans getting louder and louder on my Mac Pro 747 ready for take off. This also will affect how the Mac Mail App does for showing search results.
Indexing and indexing and indexing, WTF, is it doing it for fun!
Surely it doesn’t take that long to index a drive and keep it updated. Some of the processes that Spotlight uses to work mds and mdsworker processes are going balistic churning up CPU and putting the drive in such a loud spin that I think it’s gonna blow.
You can check these by running Top in the Terminal
Doing my head in so I put a ‘sledgehammer’ fix to stop it …
sudo mdutil -a -i off
Which basically disables Spotlight.
After a while I realised that I couldn’t search Mail or the Finder for that matter which eventually turns out to be a problem worse than the initial one, so back on Spotlight goes.
sudo mdutil -a -i on
But alas the initial problem comes back, so a different heavy handed approach is required.
Spotlight keeps its index files and database in the root of each drive in an invisible directory named:
/.Spotlight-V100
If you delete the contents of the directory and reboot, Spotlight re-indexes after the restart but now seems to be a bit more processor efficient, after a heavy initial index – just leave it for a few hours, the linked processes (mds) calm down and it starts to works normally.
Some type of random event must occur in the upgrade process to trigger this behaviour.
So if it’s driving you insane use the comand below for the main start up hard drive, it basically deletes the index database. You can’t see the directory in the finder as it starts with a leading ‘.’ which are invisible to view, so you need to do this in the Terminal, copy and paste the command.
The Terminal is found in Applications/Utilities paste in the command at the prompt.
sudo rm -rf /.Spotlight-V100/*
Restart and let the initial indexing take place then things will be OK.
Outside of that if you want to disable Spotlight on a non-boot start up drive, launch the Spotlight preference via System Preferences, click on the Privacy Tab, click the ‘+’ sign and add in any drives that you don’t want indexed.
Couple of good drives to add in here would be Bootcamp and DropBox drives if you have them!