7.12.11

The powerful, mystical Spotlight. On steroids.

The powerful, mystical Spotlight. On steroids.

The powerful, mystical Spotlight. On steroids.

March 28, 2011 · 29 comments

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.

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