I'm using Yosemite (OS X 10.10.1). If I search for the term "foo" and want a list of all files that include that term, I get foo.doc and bar.foo.doc and foodstuffs.xlsx and even The Foo History. But it does not include snafoos.docx and AllTheFooReports.xlsx. How can I change it to the (obvious!?!) behaviour of returning all results which include the search term?

I'd like to be able to do this from within Finder, not just in terminal.

  • I'm seeing e.g. barfoo.txt in a simple Finder search from the top toolbar - pretty sure it's always done that
    – Tetsujin
    Commented Mar 26, 2015 at 20:12
  • Thanks @Tetsujin. Perhaps it's a setting that has gone astray for me. But I am NOT getting internal text strings, unless they are separated by _ or . or spaces.
    – rrraven
    Commented Mar 26, 2015 at 20:24
  • hmm… I'm really not sure - maybe clear search prefs. Google seems to think that clearing Finder prefs would do it, but I'm not certain - this has instructions… thexlab.com/faqs/finder.html
    – Tetsujin
    Commented Mar 26, 2015 at 20:34

2 Answers 2


The Finder searches for word prefixes.

If you save your search as a Smart Folder and then inspect that using a text editor (e.g. TextMate) you will see the raw Spotlight query:

((kMDItemDisplayName = "foo*"cdw))

The "w" modifier tells Spotlight to search for words. The "*" wildcard at the end of the search string makes Spotlight search for word prefixes. It will match names that contain a word beginning with "foo".

That matches all of your examples but one. "foo" comes at the start of the file name, after a space or punctuation or is capitalized. The exception is "snafoos" where "foo" is just a sequence of letters in the middle of the word.

You could change the query in the smart folder to:

((kMDItemDisplayName = "*foo*"cd))

Or click the "+" button below the search field in Finder and add a "name" "contains" "foo" criterion.

Or use mdfind in Terminal:

mdfind -onlyin . '((kMDItemDisplayName = "*foo*"cd))'

Or use HoudahSpot (of which I am the developer) to get more control over your search.

  • Thanks @Pierre. Still baffled that Finder operates this way! Your mention of using the + in an existing search to specify "name" "contains" does what I need. Ideally I'd still like to make this the default search behaviour! Does HoudahSpot allow for that? I've heard good things about it before - I'll be checking it out!
    – rrraven
    Commented Mar 28, 2015 at 2:52
  • @KathyO HoudahSpot lets you save the current configuration (criteria, search locations, columns, sort order, …) "as default": New searches will open to that setup. It also lets you save templates for recurring searches. Commented Mar 28, 2015 at 8:26
  • @PierreBernard do you have a source for the behaviour of the "w" modifier by any chance? I can't find any mention of it here: developer.apple.com/library/mac/documentation/Carbon/Conceptual/…
    – Joe Taylor
    Commented Oct 27, 2015 at 17:48
  • @JoeTaylor Can't find any documentation. I may have inferred this from queries created by the Finder. Commented Oct 28, 2015 at 10:11

If you are stuck you could use a find command in a terminal window.

Open a terminal window and type :$ find . -iname \*foo\*

Here's an example using the files you mentioned in your question.

mgagnon-mbp:tmp mgagnon$ ls
AllTheFooReports.xlsx   bar.foo.doc     foo.doc         foodstuffs.xlsx     snafoos.docx

mgagnon-mbp:tmp mgagnon$ find . -iname \*foo\*

If you're not familiar with the terminal this is a fun way to learn! :) The easiest way to open a terminal windows is using a spotlight search (command-spacebar) and search for terminal.

Hope this helps.

  • Thanks @Michael Gagnon, that's good to know. I'm an old Unix user so can do all right in terminal, but was looking for a way to do this within the OSX GUI. I have never broken the habit of my Unix style filenames, which never had a spaces and silly punctuation that didn't serve a specific purpose! Good reminder that in a bind, this approach would work though.
    – rrraven
    Commented Mar 28, 2015 at 2:42

You must log in to answer this question.

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