Fixing corrupted Spotlight index on Mountain Lion (or why is my Mac Mini so slow?)

I’ve been having a problem that was driving me insane. My trusty desktop a 2011 Mac Mini (Server edition) with Mac OS X Mountain Lion was unbearably slow when doing pretty much anything.

I thought it was the Software RAID, so I removed it. I thought it was because of the external drive (whenever a USB drive spins up, the system halts for a second, very annoying feature). So I turned it off.

After some searching I found that the likely culprit could be a corrupted Spotlight index. No idea why something simple like that would impact everything, including opening tabs in Google Chrome, but the errors in the log matched.

The thread that helped me was: mac mini running EXTREMELY slow

You should check your system logs (through the Console application) and look for the following errors (PID’s and date/times removed):

mdworker[]: Unable to talk to lsboxd
sandboxd[]: ([]) mdworker() deny mach-lookup com.apple.ls.boxd

Triggering the rebuild can be done from the command line by executing:

sudo mdutil -E /

This will start the background job of rebuilding your spotlight index.

 

I did also start my Mac in safe mode, which could have also helped.