Even though I've explicitly set the Finder preference to display all file extensions, I'm still finding that some apps do not show the file name extension in their Spotlight result.
Here are some examples.
I'm running Mountain Lion.
high sierramacossearchspotlight
Even though I've explicitly set the Finder preference to display all file extensions, I'm still finding that some apps do not show the file name extension in their Spotlight result.
Here are some examples.
I'm running Mountain Lion.
Best Answer
TL;DR
Basically, it's a bug or bug fix introduced in macOS 10.13 High Sierra: Spotlight now respects the Finder setting to show file extensions. Disabling that setting removes the .app extension from Spotlight.
Full-length answer
I know this is a very old question, but I just had a déjà-vu in 10.13 High Sierra; different to this one but with some similarities, so I searched for it and stumbled upon this question and here's my answer:
Apps are in fact directories displayed as if they were a single file; Apple calls that a bundle (despite the Finder naming it "Package" as in "Show Package Contents" in the context menu). Not just applications are bundles, Apple uses bundles also for frameworks, plugins, application extensions, XPI services, certain kind of installer packages, as well as data storage format if stored data consists out of multiple files but shall appear as just one file (e.g. a RTF document with pictures can be stored as a RTFD bundle). Bundles always have a real name, the name of the file entry on disk. So if there is nothing else to display, macOS displays that name everywhere.
However, bundles have a info file inside, named
Info.plist
, which contains all kind of meta data about the bundle. One thing such an info file can define is a Display Name. If such a display name is set, Finder will display the display name and not the real name of the directory. That is, unless the directory has been re-named, which the Finder can detect if the directory name does not match the bundle name in theInfo.plist
file. Well, I admit, it's a bit complicated. Let's try it with an example:My App.app
Info.plist
isMy App
Info.plist
isMy Cool App
With that combination, Finder will show the app as
My Cool App.app
(or justMy Cool App
if extensions are hidden). As long as (1) and (2) match in name, (3) is displayed.If I now rename the directory to
My Boring App.app
, then Finder will display it asMy Boring App.app
since as soon if (1) and (2) don't match in name, (1) is displayed, as if the user wants his/her app renamed, of course, Finder should display the user chosen name, makes sense, doesn't it?Complicated enough already? Well, I'm sorry, but it gets even more complicated now. All values in the
Info.plist
that are displayed to users can be localized, so if your system is set to US English, the bundle display name may beMy Cool App
, but if the system is set to UK English, it can beMy Amazing App
. If a localization exists for the current system language, Finder will display that localization, but again, only if the names of (1) and (2) matches, otherwise (1) will win again.Localizing is done by placing
.strings
files into bundles into sub-directories that are named<x>.lproj
, where<x>
can just be a language code, e.g.en.lproj
for English,fr.lproj
for French, etc. But in can also be language + country, likeen_US.lproj
,en_GB.lproj
,en_AU.lproj
, and so on. Inside is a file namedInfoPlist.strings
and this file can override the base values of theInfo.plist
file. If no matching localization is found, the values from the base localization are used (named development region) which is also defined by theInfo.plist
file. If no such localization is defined, the values from theInfo.plist
are used directly.Spotlight behaves like Finder, if (1) and (2) match in name (3) is displayed, either directly or from the matching localization. If (3) isn't set, (1) is displayed. But unlike Finder it does not always add the
.app
extension, even if requested in Finder preferences. I wasn't able to ever find the exact behavior pattern, but a certain combination of setup will prevent Spotlight from showing the extension, regardless of what you have configured. For some users it is fixed by changing the Finder setting and then runningsudo mdutil -E /
inTerminal
(which re-indexes everything). But it's not working for all users, which may have something to do with the chosen language/region.Basically it's a bug. Either re-indexing fixes it or it can't be fixed. And the behavior was changed by Apple at some macOS release and stayed constant thereafter... that is, until 10.13 High Sierra. All of a sudden all my apps have
.app
extension in Spotlight, which matches my Finder setting, whereas in 10.12 Sierra no app had an extension in Spotlight, despite the Finder setting, unless I have renamed it or unless I had multiple copies of lying around.