12

I want to exclude Mail messages from showing up in Finder search.

->FINDER, NOT SPOTLIGHT<-

I have asked this question on other platforms, and I have found the emphasis is very necessary. Yes, you can exclude Mail from Spotlight by going to the Spotlight preference pane and unchecking Mail. This has no effect on Finder, at least in Mavericks (it did in Lion. I skipped Mountain Lion, but I believe it also suffers from this problem.)

You can also narrow what IS returned in Finder search, by clicking the plus sign and adding filters. But this is not a solution either: you can only filter what "is" returned, there is no "is not" option.

For bonus points, answers about how to exclude folders would also be wonderful. If you have ebooks, you know that they too turn up in pretty much every search. Put simpler, I just want the Spotlight preferences to apply to Finder...like they used to.

3
  • +1 I would also love to know how to get Outlook mail messages from showing up in either search. If I wanted to search my e-mail, I'd do that in the e-mail interface. Commented Feb 26, 2014 at 2:27
  • 1
    @AaronBertrand - Technically you can prevent both from showing Outlook results using the method below, by adding ~/Documents/Microsoft User Data/Outlook 2011 Identities to Spotlight's exclude list. However, Outlook uses Spotlight's index for it's own search function. By excluding the above folder from Spotlight you in effect exclude it from Outlook's search as well. This is one of those shortcomings that I and several of my users have reported to Microsoft as a feature request for the next version. You can do the same by clicking the Help menu in Outlook and choosing "Send feedback".
    – Mr Rabbit
    Commented Feb 26, 2014 at 13:02
  • 1
    @MrRabbit Yeah, that's the challenge, I still want to be able to search in Outlook, but I don't want Finder/Spotlight searches to mix 5,000 e-mail messages with 20 files. Commented Feb 26, 2014 at 15:44

4 Answers 4

13

It is inconvenient, but if you add -kind:mail after your search term in the Finder, it will exclude Mail messages too.

10
  • 1
    This does exactly what I wanted, and has no impact beyond Finder. Changing my accepted answer to this.
    – friggle
    Commented Sep 4, 2014 at 23:55
  • you should receive 100,000 upvotes for this answer :) I have been resorting to UNIX "find," which doesn't use indexing and is super slow, to search for files because of the idiotic defaults in finder and spotlight.
    – Reb.Cabin
    Commented Sep 22, 2015 at 15:29
  • @Reb.Cabin Thanks for the extra upvotes :^) Have you used mdfind at the command line? maybe mdfind XXXXX | grep -vi mail ?
    – beroe
    Commented Sep 22, 2015 at 20:34
  • @beroe thanks for the lead on mdfind. I think it will help speed up some of my searches ( I have over 2,000,000 files in various states of disorganization, and mostly I'm searching for a half-remembered fragment of a name or some keyword in the content when someone comes up to me and asks "do you know anything about 'blarghalism'." Of course, I wrote some notebook in the 90's about just that very topic; just let me find it...
    – Reb.Cabin
    Commented Sep 23, 2015 at 17:15
  • This does not work on El Capitan.
    – Jim L.
    Commented Feb 27, 2016 at 15:15
7

First of all, I should point out that — despite what it looks like — search in Finder is indeed Spotlight but with more options shown. The following information is based on research I've just done on my Mac running Mavaricks (10.9.2):

The reason why it doesn't work to just uncheck Mail is because (confusingly) the SysPrefs > Spotlight > Search Results tab only applies to the top-right corner Spotlight search and not the one in Finder.

However, there is a work-around that answers 2 of your question and proofs that Spotlight is the engine for Finder searches (and ditto for other apps, including Mail and Outlook):

You can exclude a folder from Spotlight-powered searches by dragging said folder to the list in the SysPrefs > Spotlight > Privacy tab.

Caveat/but/proof:

If you were to do this with the data folder of Mail.app (~/Library/Mail), you'll get this warning: Warning when adding Mail.app's data folder to "Privacy"

...Telling you that "the search feature won't work in some applications" If you click OK, Mail messages won't show up in Finder (or Spotlight) anymore but the same will be the case for the internal search feature in Mail.app itself, since it's Spotlight-powered...

(@Aaron Bertrand: Same for Outlook, since it's also Spotlight-powered. See first link above)

With regular folders — i.e. not in your hidden-by-default Library folder — you won't get a warning and hiding'll work with no caveats.

There actually is an option to tell Finder to not seach for a given type by writing "NOT eml" for instance, in the search field, which would exclude e-mail files. If you really wanted to, you could create an Automator-service and bind +F to it via SysPrefs > Keyboard > Shortcuts. The Automator AppleScript would be akin to:

activate application "Finder"
tell application "System Events"
    keystroke "f" using command down
    keystroke " NOT eml"
    key code 123 using command down #123 = Left Arrow, so we're moving the cursor to the beginning of the field
end tell

(I suck at AppleScript so there might be a cleverer way to go about it)

3
  • I'm accepting this as an answer because the fact that Finder search respects the Spotlight > Privacy settings is an answer to a number of Finder search problems. I had my eBook folders in there already, but Finder was still searching them. I removed and re-added them and they are now excluded from Finder search.
    – friggle
    Commented Feb 26, 2014 at 18:00
  • But it's still not a complete answer, because disabled Mail from being searched by anything ever isn't a full solution. It's pretty ridiculous that HALF the Spotlight preferences apply to Finder. It makes some sense since other apps are powered by Spotlight, but on the other hand, it worked in the earlier OSes.
    – friggle
    Commented Feb 26, 2014 at 18:06
  • @friggle I see your point. If I'd been able to find any trace of a "non-hacky" solution, I would certainly have provided it. That Apple pride themselves with making products with as few settings as possible sometimes means that weird stuff like this happens without anyone noticing... I even went poking around in "Secrets" to see if there was some obscure Spotlight/Finder flag that could be changed but to no avail.
    – Lasse
    Commented Feb 26, 2014 at 18:12
1

The root cause of this problem is that Finder by default searches "This Mac" - i.e. everywhere, including the Mail folders - so every search is dominated by dozens of unwanted email hits. Fortunately there's a simple solution:

In Finder...Preferences...Advanced, select "Search the current folder". This will limit the search to whatever folder you were in when you requested the search, thus excluding emails (and a lot of other unnecessary stuff too by the way). Problem solved.

Here's a link to the details: http://osxdaily.com/2013/03/12/change-finder-search-to-look-in-current-folder-rather-than-everywhere-in-mac-os-x/

1
  • 1
    The problem I have is that I need to search my Documents folder. Email events and attachments are files under that folder! 😡
    – Jim L.
    Commented Feb 27, 2016 at 14:55
1

I know this is an old question, but up to this date the issue with Finder search including way too many results has not been solved by Apple. What has changed is the format needed for the suggested answer (it doesn't work anymore). Also I found a way to very quickly add the suggested trick to any search, no typing required.

Step 1: create a search that excludes the file types you don't want to be included in your searches. I used NOT kind:olk15 AND NOT kind:eml AND NOT kind:ZIP The olk15 is for Outlook mail, that will not be excluded when only filtering 'eml' out. I also excluded ZIP files, but that is a personal preference.

Note: as you can see I did NOT search for any text, so the results will be about any file on your system. No problem, please read on.

Step 2: use the 'Save' search option and add the search filter to your sidebar. I named my search 'NotEmail'

Saved search in sidebar

There is no step 3 :-)

Whenever you want to do a clean search, first click your saved search and then use the search field to enter the text within that search you want to find.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .