What determines the label displayed in the “Kind” column of an OS X finder window and in search box labeled “Kind”

finder

What determines the label displayed in the "Kind" column of an OS X finder window and in search box labeled "Kind"?

For example, I use LaTeX, and all files with the extension .tex are labeled "LaTeX" in the finder Window and I have them set to open with SublimeText.

Did SublimeText set the file "Kind"?

Also, if I want to search for all file of type "LaTeX" the Finder search box only gives me a limited set of options for "Kind", e.g. Application, Archive, Document, etc. Can I change that option box to show "LaTeX".

Best Answer

CFBundleDocumentTypes

To answer your first and second question:

OS X applications are able to register document types with the system. They do so by declaring those document types within the CFBundleDocumentTypes section in the Info.plist file which resides inside the application bundle.

For example, you can find the entry for the LaTeX kind by opening Terminal.app and invoking this command:

$ grep LaTeX -B4 -A7 /Applications/Sublime\ Text\ 2.app/Contents/Info.plist

The resulting XML chunk defines the three-way relationship between the application, the name of the bundle type (aka Kind), and the respective file extensions:

<dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleTypeName</key>
    <string>LaTeX</string>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>tex</string>
    </array>
    <key>CFBundleTypeIconFile</key>
    <string>TeX</string>
</dict>

For more details about document types, see the section CFBundleDocumentTypes in the document Registering the File Types Your App Supports from Apple’s Developer Library.

Spotlight searches

To answer your third question:

Can I change that option box to show "LaTeX"

Open the drop down box and choose Other. A text box appears; type the name of the file kind you wish to search for, or any substring of it.

If the Other option won’t appear in the drop-down list, you might need to enable the option first by going to System Preferences » Spotlight and ticking the checkbox next to Other.