10.4: Make Spotlight index PHP files

May 25, '05 08:40:00AM

Contributed by: Lazarus Long

Tiger only hintHere's how to get Spotlight to index your PHP scripts. In the Finder, navigate to /Library/Spotlight and locate SourceCode.mdiporter (this is installed with the Developer Tools). Select the file, control-click on it, and choose "Show Package Contents" from the pop-up menu. Now go into the Contents folder in the newly opened window. Double-click on info.plist (this should launch Property List Editor).

Click the triangle to expand Root, then expand CFBundleDocumentTypes, expand 0, then finally expand LSItemContentTypes. Click on the last number in the list (for me it was 6), then click the New Sibling button in the toolbar to add a new key. For the string value, enter public.php-script.

Close the Property List Editor and save when prompted. Go to a Terminal prompt and type:

mdimport -r /Library/Spotlight/SourceCode.mdimporter
Spotlight will now set to work indexing all your PHP files.

[robg adds: I tested this one, and it worked just as described.]

Comments (23)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050514182520714