CPU usage no more! indexing and mdworker, while compiling

When compiling programs on Mac OS X, mdworker indexes the compiled binaries… while the code is compiling.  Or horrors of horrors!  mdworker is the background process that gathers and indexes meta information (meta data) for Spotlight.  This is a great tool, but we don’t want or need it to index binaries as we are compiling a large project.

To disable indexing (and therefore disable mdworker, but not disable Spotlight) use the command:

sudo mdutil -i off -a

If you like your indexing and like to use Spotlight (like I do), be sure to turn things back on after you’re finished compiling with the command:

sudo mdutil -i on -a

But perhaps Apple has configured mdworker to only use idle CPU time, so that it doesn’t take valuable resources from the compiler.  This is a good question for a later post.  What’s your experience been like?