I'm wondering if there is a way to exclude specific applications from Spotlight searches in Yosemite. I'm looking to exclude Apple Mail from coming up and then launching from Spotlight. I can successfully hide it in /Applications, take it out of the dock on start up and also remove it from Launchpad.
However, I cannot get it to be excluded from Spotlight unless I specifically go in to System Preferences > Spotlight and uncheck "Applications" but then that takes away the ability to search for any app through Spotlight. Anyone have any ideas? Any help is appreciated.
I don't know if there's a way to exclude only certain applications from showing up in Spotlight as opposed to entire folders. Although technically application bundles are folders, the Spotlight settings does not see them as directories to add in.
I just tested programmatically adding in an Exclusion to my Spotlight VolumeConfiguration.plist to add "/Applications/Mail.app" but it neither shows up in the Spotlight System Preferences GUI nor does it stop Mail.app from appearing in Spotlight search results, so it doesn't seem it works for anything other than entire folders.
Just curious, but if you really want to prevent Mail.app from being used, why not just remove the application? Or, compress it into a zip and move the zip into a completely different location, and then delete the original in /Applications/ That would stop it from being used, but still give you the ability to re-instate it by unzipping the file and placing it back into /Applications/
From what I have found, if you move the app to a Library folder Spotlight will not find it.
You do need to re index once for it to not show up.
You can do that with mdutil.
For example I will be moving the Photos.app to a folder in our local admin accounts library folder.
Then reindex spotlight and bam, it is gone to the user.
This way if needed I can simply move it back to the Applications folder.
I am testing my scripts now.