I found that mds and mdimport were constantly running, and often taking up to 90-100% of my CPU when it was otherwise idle.
These processes are used by spotlight to index the hard drive and make files searchable. It usually runs when the system is idle and should run instantly whenever files are updated. My CPU usage seemed excessive though, and detrimental to battery life.
So I dug around to see if I could reduce the idle time CPU usage. This is mostly for me to refer back to later.
By running this command, I was able to see what files mdworker was opening to index:
sudo fs_usage -w -f filesys mdworker
… and I discovered the main culprit: Backblaze (cloud backup) was generating file lists whenever anything was change don the system, and mds was indexing them. Combing through these logs for a while, i added a few exclusions to spotlight’s indexing via the System Preference which seems to have dramatically reduced the activity mds/mdimport activity.
- /Users/amit/Library/Application Support/Crash Reporter
- /Users/amit/Library/Application Support/Quicksilver
- /Users/amit/Library/Application Support/Spanning Sync
- /Users/amit/Library/Application Support/SyncServices
There were all frequently being indexed and things I didn’t need to search for.