Using Spotlight with Boolean and Metadata Operators

Spotlght search with metadata

Coyote Moon, Inc.

Spotlight is Mac’s built-in search service. You can use Spotlight to find just about anything stored on your Mac, or any Mac on your home network.

Spotlight can find files by name, content, or metadata, such as date created, last modified, or file type. What may not be obvious is that Spotlight also supports the use of Boolean logic within a search phrase.

Using Boolean Logic in a Phrase

Start by accessing the Spotlight search service. You can do this by clicking on the Spotlight icon (a magnifying glass) in the menu bar at the top right of your screen. The Spotlight menu item will open and display a field for entering a search query.

Spotlight supports AND, OR, and NOT logical operators. The Boolean operators must be capitalized in order for Spotlight to recognize them as logical functions. Some examples include:

  • boot NOT camp will find any file whose name or content includes the word boot but does not contain the word camp.
  • Boot –camp the minus sign is another way of using the NOT Boolean operator. Technically, the minus signs mean AND NOT, but since the AND function is implied, the NOT and the minus (-) sign tend to produce identical results.
  • boot AND camp will produce the same results as a search on boot camp because AND is the default operation when more than one word is included in a search. Even though AND is the default search type, there are explicit times when you may wish to use it, such as when searching for multiple phrases as in this next example.
  • “Now is the time” AND “Alanis Morissette” would return any file that contains both phrases, but would not return any file that only contains one of the phrases. Note the use of quotes to define a phrase.
  • boot OR camp will find any file that contains either word. You may see results that include references to hiking boots and a camping trip, as well as Apple’s Boot Camp.

In addition to Boolean operators, Spotlight can also search using file metadata. This allows you to search for documents, images, by date, by kind, etc. When using metadata as a search, place the search phrase first, followed by the metadata name and property, separated by a colon.

Spotlight Searching Using Metadata

  • Tom kind:folder will search for any folder that has Tom in the name.
  • Sunflower kind:image will search for images with Sunflower in the file name.
  • Dave Matthews kind:music will find all of the music on your Mac by Dave Matthews.