Finding out why mdworker is running crazy

From time to time mdworker on my Mac seems to be running wild. I know it is related to Spotlight but it sometimes it would be nice to see what is actually causing mdworker to run to much.

Looking at the documentation for fs_usage it looks like the best command for checking file activity.

 fs_usage -- report system calls and page faults related to filesystem activity in real-time

Just running fs_usage gives us way too much information so to narrow it down, we need to use a few extra options. Adding -f filesys will give us a detailed filesystem output but let’s cut it down to only mdworker related tasks.

sudo fs_usage -f mdworker

This should give us all the information that we want, but it includes all types of activity whereas we just want the ones labeled ‘open’. To achieve that, we can run:

sudo fs_usage -f filesys mdworker | egrep "open"
 

Leave a Reply