Your Mac comes with an extraordinary search system called Spotlight. It’s so great, so fast, so near perfection, and oh so coveted by certain unnamed Apple competitors. How on earth can it be so good, you ask? Well, it’s hard to say. But some have speculated that it runs on only the purest tears collected from Apple’s most prized unicorns. Alas, no one has ever seen one of these creatures, which are said to be stabled in a secret location outside of Cupertino.

Until someone – most likely a Gizmodo reporter – finds that stable, I’m okay just calling it magic and using it to find stuff really fast.

Spotlight on steroids

I have to confess that until very recently, I didn’t know you could include file attributes in Spotlight searches. When I found out, it blew my mind, and I began to scour the web for tips and tricks.

This post is more or less what I found. I’m sure there’s more. Addend me in the comments.

File attributes

Your Mac stores a lot of metadata for your files. Just do ‘Get Info’ on a file and take a look at all that stuff. Much of those attributes are fair game in Spotlight searches. Simply include an attribute in a Spotlight search followed by a colon (:).

AttributeType:attribute

Here are a few common attribute types:

  • Name (i.e. the file name)
  • Kind (e.g. App, Text, PDF, Spreadsheet, Document, Image, Movie, Music, Folder, Message, and more)
  • Modified
  • Created

Special file types like music have even more. You can use things like “by” to search music by artist. Experiment; explore. You can’t hurt anything.

I find that just using the name attribute is a powerful way to narrow searches. It cuts out any hits that come from matching content. I usually remember some piece of file names, and I almost always know what kind they are. Like, say I was trying to track down my Nikon manual:

name:nikon kind:pdf

That's probably enough to take me straight there.

Powerful date searches

The ‘Modified’ and ‘Created’ attributes can accept all kinds of dates. You can use things like:

  • Yesterday
  • Today
  • Tomorrow (kidding)
  • To search before a date, <1/1/2011
  • To search after a date, >1/1/2011
  • To search in a date range, 1/1/2011-3/13/2011

Suppose you wanted to see every text file you modified in the month of March containing the word “monkey”:

monkey kind:text modified:3/1/2011-3/31/2011

Boolean stuff and more

Like a web search field, Spotlight supports boolean operators like AND, OR, and NOT. You can also use a minus sign (-) to exclude terms. For example:

chocolate recipes -coconut

Use quotation marks to enclose phrases and parentheses to enclose search terms:

chocolate AND "peanut butter" NOT (almonds OR coconut)

Other tips

  • Check your Spotlight Preferences if you don’t see the files you expect to see when doing searches. You may be excluding that file type from Spotlight’s index.
  • Spotlight does math too. Just type an expression, and it’ll evaluate it for you right there.

Other articles on Spotlight search