Urania

A blog named for the muse of Astronomy containing musings by an astronomer

Archive for July 12th, 2007


HINT: Sportlight indexing for Perl, PHP, Ruby, and Fortran Coders 0

Posted on July 12, 2007 by Juan

This hint is my writeup based on a similar hint at MacOS X Hints for Making Spotlight index PHP files.

I write a lot of perl code using BBEdit, and wanted Spotlight to index my perl files. To do this, a simple modification of the the SourceCode.mdimporter is needed. First find the type (according to
Spotlight) of the files you want indexed, as PerlFile.pl using this command (via the Terminal):

mdimport -n -d1 PerlFile.pl

which outputs something like:
Import 'PerlFile.pl' type 'public.perl-script' no mdimporter

Now take that file type (public.perl-script) and add it to the Info.plist file located at /Library/Spotlight/SourceCode.mdimporter/Contents/Info.plist (If you can’t find this file, you likely installed Apple’s MacOS X Developer Tools yet). Add it in the array for LSItemContentTypes.

I added:

<string>public.perl-scrip</string>t<string>
public.php-script</string><string>
public.python-script</string><string>
public.ruby-script</string><string>
public.fortran-source</string>

Now you can index your source code files in one of three ways:

  1. Go to a Terminal prompt and type:
    mdimport -r /Library/Spotlight/SourceCode.mdimporter

    to process all your source code files and import them into Spotlight’s database.
  2. Go to the Terminal and trigger the re-importation of the directory containing your source code using
    mdimport /PathToFiles/ToImport
  3. Go crazy and re-import everything on your drive using
    sudo mdimport /

To see what is going on, add the -d1 switch to the mdimport command.

First Post 0

Posted on July 12, 2007 by Juan

This is my web blog which I will be using mostly to note things of interest to me. Its not necessarily meant for public consumption and will contain such exciting topics as

  • The installation of software of interest to astronomers on MacOS X machines (I’ve had experience getting AIPS, IRAF and Hectospec’s packages to run under MacOS).
  • Bugs in the MacOS operating system that need to be crushed in order to run some astronomical software on the Mac.
  • Notes on neat command line tricks I discover.
  • Musings on other topics such as teaching or academia.

Don’t expect to see anything too daring yet, I don’t have tenure.



↑ Top