Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Change Spotlight search categories System 10.4
I've been trying to make Spotlight more useful to me, and one of the first things that came to mind was changing the categories of files that it searches. I rarely if ever search for Bookmarks, Fonts, Mail Messages, Contacts, System Preferences, or Events and To Do Items, and was wondering if I could replace them with something more convenient.

Anyway, it turns out that this is possible, although not as completely as I would have hoped. You can quite straightforwardly change an existing category to list a different type of file. Note that this does not stop Spotlight from showing files in the category you replace, it just makes them show up as normal documents. You can also add a new category. However, if you do this, it will only show up in the results window, not in the list that drops down from the menubar or in System Preferences. Changing an existing category will probably be more useful to most people.

Warning: these methods involve modifying five system files. You may completely stuff up Spotlight, or your entire system, if you do something wrong. Read on for the step-by-step...

[robg adds: I have not tested this one, and it does require editing some relatively deeply-buried system files. However, the concept seems amazingly useful; hopefully Apple adds the ability for self-created categories in 10.5 (or some enterprising coder adds a third-party GUI app for it in 10.4). For this one, though, proceed at your own risk.]

Before changing anything, make sure you back up by running these commands in the Terminal (just copy and paste to a Terminal window):
$ sudo cp /System/Library/CoreServices/Search.bundle/Contents/\
Resources/MDSimpleGrouping.plist /System/Library/CoreServices/\

$ sudo cp /System/Library/CoreServices/Search.bundle/Contents/\
Resources/English.lproj/MDSimpleGrouping.strings /System/Library/\

$ sudo cp /System/Library/Frameworks/CoreServices.framework/\
MDPredicate.plist /System/Library/Frameworks/CoreServices.\

$ sudo cp /System/Library/Frameworks/CoreServices.framework/\
English.lproj/MDPredicateKeywords.plist /System/Library/\

$ sudo cp /System/Library/PreferencePanes/Spotlight.prefPane/\
Contents/Resources/English.lproj/Localizable.strings /System/\
Once that's done, here's how to tweak Spotlight to match your needs...

Changing an existing category

As an example, we will change the Bookmarks category into a Microsoft Word Documents category. Bookmarks will still be displayed but as ordinary documents, while Word Documents will now have their own category.
  1. First we have to actually change the type of file that is put into the category. In your favourite text editor (I use vi), with administrator privileges, open this file: /System -> Library -> CoreServices -> Search.bundle -> Contents -> Resources -> MDSimpleGrouping.plist. Change the following line (note that some spaces were removed for a narrower display):
    ""           = "BOOKMARKS";
    to this:
    ""              = "BOOKMARKS";
    Save and close the file. Then open /System -> Library -> CoreServices -> Search.bundle -> Contents -> Resources -> English.lproj -> MDSimpleGrouping.strings, and replace this line:
    "BOOKMARKS" = "Bookmarks";
    with something more representative:
    "BOOKMARKS" = "Word Documents";
    Save and quit your editor. Now documents of type will fall under the category with dummy name BOOKMARKS, but will be labeled as Word documents.

  2. Now we want to allow keyword searches for our new category. Open -> System -> Library -> Frameworks -> CoreServices.framework -> Versions -> A -> Frameworks -> Metadata.framework -> Versions -> A -> Resources -> MDPredicate.plist, and replace the following line:
    BOOKMARKS  = "kMDItemContentTypeTree =";
    BOOKMARKS  = "kMDItemContentTypeTree =";
    Save and close the file. Then open /System -> Library -> Frameworks -> CoreServices.framework -> Versions -> A -> Frameworks -> Metadata.framework -> Versions -> A -> Resources -> English.lproj -> MDPredicateKeywords.plist and change:
    to something like:
            <string>kind:word document</string><br>
    (or choose your own keywords). Save and quit.

  3. Finally, we want to make our new category labeled correctly in the Spotlight preferences panel, so we can change where it appears in the results list. Open /System -> Library -> PreferencePanes -> Spotlight.prefPane -> Contents -> Resources -> English.lproj -> Localizable.strings, and change this line:
    "CATEGORY_BOOKMARKS" = "Bookmarks";
    to this:
    "CATEGORY_BOOKMARKS" = "Word Documents";
    Save and quit.

  4. Now to make these changes take effect, type this command into Terminal, then press Enter:
    killall SystemUIServer
    When the Spotlight icon reappears in the menubar, Word documents should have their own category, and you should be able to find all the Word docs on your computer by typing kind:word. The only minor catch is that the wrong icon is displayed for the new category in the Spotlight prefpane (icon data seems to be stored in /System -> Library -> PreferencePanes -> Spotlight.prefPane -> Contents -> Resources ->, and can't be easily changed).
Adding a new category

It is also possible to add an entirely new category, but files that fall under it will only show up in the Spotlight results window (default Command-Option-Space). They will not show in the drop-down list from the menubar (unless they are the top hit), and not in the Spotlight preferenes pane, which means they will always appear at the bottom of a search.

To add a new category, follow the instructions for changing a category, but add the given lines to the relevant files instead of altering existing lines (don't worry about changing the prefpane Localizable.strings file: it won't do anything). It doesn't matter where in the strings files the lines are added, but in the plists they must be added in the right place. The easiest way is just to copy one of the existing lines and paste it directly underneath.

Final Comment

You can use this method to change or add (or even remove) any Spotlight category. If you don't want to lose a category, you could change one as descibed above, and then merge the one you replaced into another related category. For example, on my computer, I've combined the Contacts and Events categories into one, and made a category for Word docs. You could also just add new filetypes to existing categories by adding a line in MDSimpleGrouping.plist.

One final note: you may have noticed that two of the plists we encountered here contain the keyword definitions that enable you to type things like date:yesterday or kind:movie into the Spotlight bar (these are the ones with predicate in the name). You can tinker with these files to create other keywords for filetypes or date ranges that you use a lot. You could, for instance, create the kind:word keyword without making a new category specifically for Word documents.
  • Currently 2.00 / 5
  You rated: 2 / 5 (5 votes cast)

10.4: Change Spotlight search categories | 6 comments | Create New Account
Click here to return to the '10.4: Change Spotlight search categories' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
GUI to change search categories
Authored by: lightbulb on Aug 04, '06 08:10:07AM
i believe this program does the same thing, but i'm not sure, as i haven't tried it:

[ Reply to This | # ]
GUI to change search categories
Authored by: Membranophonist on Aug 04, '06 02:45:09PM

BSP is a little buggy, but it is a good way to edit the categories displayed for search results in both the Finder and Spotlight results windows.

[ Reply to This | # ]
GUI to change search categories
Authored by: wordsofwisedumb on Aug 06, '06 10:19:28AM

I just tried BSP. It doesn't work at all for me... Then I restarted and my menu items will not load. None of the native OS X menu bar items work (spotlight, airport, volume, etc.). It screwed things up for other user accounts too. I would not recommend using or even trying BSP.

If anyone has any possible methods for me to fix this I would be glad to hear them too.

[ Reply to This | # ]
GUI to change search categories
Authored by: wordsofwisedumb on Aug 06, '06 11:13:25AM

Scratch that, the issue is unrelated to BSP. That still doesn't change the fact that it didn't work for me. It is a very buggy piece of software.

[ Reply to This | # ]
10.4: Change Spotlight search categories
Authored by: broomdodger on Aug 04, '06 07:28:21PM
NotLight has the ability to make customized Spotlight searches.
NotLight is a great front end to the Spotlight technology.

[ Reply to This | # ]
10.4: Change Spotlight search categories
Authored by: Krazy on Aug 06, '06 09:34:56PM
You might also want to have a look at Spotmeta
Haven't used it myself, but looks interesting.

[ Reply to This | # ]