Adding filetypes to Spotlight

By default, Spotlight doesn’t index every file on your hard drive, and it’s not very user friendly to add additional types. This guide details how to add files to the spotlight index.

Index Third-Party Filetypes

A growing list of applications have Spotlight plugins available for download. These plugings usually take the form of a package and install all the necessary files (in /Library/Spotlight).
For a complete list, see Apple’s Spotlight download page.

Index PHP files

This section illustrates, by example, how to add PHP files to your spotlight index.

  1. Install the developer tools
  2. In the finder, Go to “/Library/Spotlight” (command-shift-G)
  3. Control-click on SourceCode.mdimporter (which is there if you’ve installed the developer tools) and show package contents
  4. Open Info.plist in (preferably) Property List Editor. Otherwise, you’ll be editing XML in a text editor
Property List Editor
  1. Add the following to Root->CFBundleDocumentTypes->0>LSItemsContentTypes
  2.     public.php-script

  3. Open Terminal and type
  4.     mdimport -r /Library/Spotlight/SourceCode.mdimporter

  5. After a while, when Spotlight finishes reindexing, you’ll be able to search inside PHP files.

Index c and c++ header files

  1. Open Terminal
  2. Type this:
   mdimport -f /usr/include
   mdimport -f /usr/local/include
   mdimport -f /System/Library/Frameworks

 

Share or Bookmark This Post:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • LinkedIn
  • Netvibes
  • Reddit
  • StumbleUpon
  • Tumblr
  • TwitThis
  • Yahoo! Buzz

Random Posts

Leave a comment

Your comment