Search through text files in Mac OS X

You can't do this from the spotlight icon in the menu bar. But you can do it with spotlight:

  1. Navigate to the folder in the finder.

  2. Type your search in the search bar on the top right of the folder.

  3. There is a line above the results that says:

Search: This Mac "Your Folder Name"

Click on the name of your folder to restrict the search to the folder instead of the whole computer, which is what the default selection "This Mac" does.

Then click the gear icon, choose show search criteria, and change the kind to text files.


If you prefer the command line,

grep "my string of text" -R .

You'll need to be (or get) familiar with grep. Read man grep for more info.


Very powerful and fast

mdfind "text to find"

Description: Mac Dev Centre - The Power of mdfind


In the upper right hand corner of your screen: Spotlight

BBEdit supports great search, too, in files and folders.