Spotlight, UserFilesOnly, kMDItemSupportFileType, and MDSystemFile

Recently, VMWare Fusion stopped appearing in Spotlight results. Other queries return expected results, and the spotlight index info for Fusion appears OK at first glance via:

mdls "/Applications/VMWare Fusion.app"

What’s going on, then? To get a different perspective, I tried a Spotlight search in Finder:

before… and then saved the results, and examined the resulting XML file¬†with Property List Editor:

query plist editorIt seems there are additional filters in this search that aren’t accounted for in the UI (which is typical Apple, but I digress) such as FinderFilesOnly and UserFilesOnly. I decided to try running the raw query without those extra filters using¬†mdfind, and sure enough:

$ mdfind '(** = "vmware fusion*"cdw) && (kMDItemContentTypeTree=com.apple.application)'
/Applications/VMware Fusion.app

A closer look at the mdls output for VMWare Fusion.app reveals the culprit:

$ mdls -name kMDItemSupportFileType /Applications/VMware\ Fusion.app
kMDItemSupportFileType = (
    MDSystemFile
)

Kill it with overwriting but not deleting:

$ sudo xattr -w com.apple.metadata:kMDItemSupportFileType "" /Applications/VMware\ Fusion.app
Password:
$ mdls -name kMDItemSupportFileType /Applications/VMware\ Fusion.app
kMDItemSupportFileType = (null)

… and now everything’s OK again:
after

About dre

I like all kinds of food.
This entry was posted in OS X. Bookmark the permalink.

Leave a Reply