I am using OSX 10.6 and want to have content searches in finder for the source code types i use. This suggests a (10.4 only?) solution, but although i have the developer tools installed i don't have /Library/Spotlight/SourceCode.mdimporter.

Is there a different procedure for Snow Leopard or did i miss something?

This looks better, but how to register new file types which don't have UTIs yet?

To clarify - i am ok with a simple plain text search through these files...

  • What types of text files are you using that aren't already being indexed? Mar 27, 2010 at 20:20
  • Currently e.g. .cmake .
    – gfr
    Mar 28, 2010 at 0:03

3 Answers 3


So it seems your problem is not in getting Spotlight to add something as much as getting the OS to see that .cmake files are plain text.

From the first edit I'm guessing that mdimport -n -d1 somefile.cmake isn't returning anything useful (If it is just add that type).

If it's not, try mdimport -d1 *.cmake public.plain-text or something similar.

Since I don't have any cmake files I can't test this.

  • mdimport -n -d1 foo.cmake doesn't output anything. As for mdimport -d1 *.cmake public.plain-text - is there a better way to do this globally then say a recursive find -exec? Can't i add file extensions that should always be automatically indexed as plain text?
    – gfr
    Mar 30, 2010 at 19:49
  • I couldn't find one. As someone mentioned, you could write your own Spotlight plugin, but that seems like a lot of work. Personally, I would either put something in cron, or add an entry to your makefile to do it.
    – Chris
    Apr 1, 2010 at 16:13

It already works fine in 10.6 for common source code file types, e.g. .c, .h, etc.

  • And for those which aren't yet supported?
    – gfr
    Mar 27, 2010 at 21:12

You'll need to produce your own Spotlight plugin which defines a UTI for those files and hands them off as plain text. You can also try editing an existing importer, but since they're all code signed now, that may or may not break something important.

cmake is generally more trouble than it's worth.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .