[R-SIG-Mac] R source file index using OS X Tiger Spotlight

Philion Vincent vincent.philion at irda.qc.ca
Wed Feb 7 17:38:38 CET 2007

Hello, I recently noticed that "R" source file contents are not  
indexed in Spotlight.

Spotlight will find "Program.R", but not the contents.

I like to use Spotlight, so I thought it would be neat to use it to  
index my R program code.

I don't know if anyone is writing a "plugin" for Spotlight, but I can  
suggest the following "quickfix".

Any files with R extension = (eg Program.R) is recognized with a  
"com.apple.rez-source" UTI.

It seems that the contents of files with this UTI are not indexed by  

With some googling, I found that it is possible to FORCE Spotlight to  
index a given UTI.

I decided to force Spotlight to consider "R" files as simple TEXT  
files. Not the best method, but it works. A "real" programmer could  
write a proper "plugin" for R files.

Based on this information:


Here is how I successfully forced Spotlight to index R file contents:

1) Open the RichText.mdimporter Info.plist
2) Add "com.apple.rez-source" to the list of text file UTIs handled  
by Spotlight
3) Force Spotlight to reimport the R files with this command in  
Terminal =
mdimport -r /System/Library/Spotlight/RichText.mdimporter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Image 2.pdf
Type: application/pdf
Size: 400266 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20070207/4d1023d0/attachment-0002.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Image 3.pdf
Type: application/pdf
Size: 344709 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20070207/4d1023d0/attachment-0003.pdf 
-------------- next part --------------

I apologize if this topic is already addressed elsewhere.

I hope this is useful or at least inspiring for a real programmer!!!

Best regards,

Vincent Philion, M.Sc. agr.
Laboratoire de production fruiti?re int?gr?e
335, Chemin des vingt-cinq Est
J3V 4P6
t?l?phone: 450-778-6522 poste 233
courriel: vincent.philion at irda.qc.ca

More information about the R-SIG-Mac mailing list