OSX Spotlight Repeatedly Crashing on High Sierra

I happened to look at my system log on may mac. To do this, open a terminal and type the following:

tail /var/log/system.log

There I noticed lines like this, repeating 10 times per second:

com.apple.xpc.launchd[1] (com.apple.mdworker.shared.00000000-0300-0000-0000-000000000000[6763]): Service exited due to SIGKILL | sent by mds[141]

mds is the osx spotlight indexer. Lots of people complain that this process is why your mac is slow, and your fan is running all the time. I found a post that showed a command you can use to see what mds is doing:

sudo fs_usage mdworker mds

I could see that my mds was basically doing the same thing over and over again. I decided to disable all indexing and clear my indexes by going into spotlight preferences, privacy tab, and adding my HD to the privacy list.

this has the effect of making mds very not busy.

Amazingy, my fan stopped in about 5 minutes after doing that! I left it like this for a day or so, but I missed spotlight so removed my HD from the privacy tab.

I decided to keep an eye on things and use the

sudo fs_usage mdworker mds

command and my own search experiences to what what it is indexing, and see if I cn get it to just index the few things I really want it to, like my documents.

What I found, is that it was easiest to use finder to select folders and drag them into the privacy tab. I started at the top level of my drive and dragged everything except Users and Applications in. Then I went into Users, my user folder and dragged everything except Documents and Pictures…etc. My fan is back on, but at least some things were excluded, and now when odd things show up in my spotlight, I will know how to exclude them.