How to Use Spotlight With Boolean and Metadata Operators

Superuser tips for the macOS built-in search service

Spotlight is the search service built into macOS. You can use Spotlight to find just about anything stored on your Mac or on any Mac connected to your home network.

Spotlight can find files by name, content, wildcards, 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 logical searches within a search phrase. Here's how to use these powerful search techniques in Spotlight.

These instructions apply to any Mac released after 2005 running Mac OS X Tiger (10.4) or later.

How to Use Boolean Logic in a Phrase in Spotlight

To run a Boolean search in Spotlight, select the Spotlight icon (the magnifying glass icon) in the Mac menu bar at the top right of the screen to open the Spotlight Search bar.

The Spotlight Search magnifying glass icon the the Spotlight Search bar

Spotlight supports the AND, OR, and NOT logical operators. The Boolean operators must be in uppercase letters for Spotlight to recognize them as logical functions, as the following examples show:

  • boot NOT camp finds any file whose name or content includes the word boot but does not contain the word camp.
  • Boot –camp with the minus sign (–) is another way to use the NOT Boolean operator. Technically, the minus signs mean AND NOT, but because the AND function is implied, the NOT operator and the minus sign tend to produce identical results.
  • boot AND camp produces the same results as a search for boot camp because AND is the default operation when more than one word is included in the search. Even though AND is the default search type, there are times when you may want to use the AND operator explicitly, such as when searching for multiple phrases.
  • "Now is the time" AND "Alanis Morissette" returns any file that contains both phrases but would not return any file that only contains one of the phrases. (Note the use of quotation marks to define a phrase.)
  • boot OR camp — finds any file that contains either boot or camp. You may see results that include references to hiking boots and a camping trip as well as Apple Boot Camp.

How to Search Using Metadata in Spotlight

In addition to Boolean operators, Spotlight can search using file metadata. This functionality enables you to search for documents, images, and more by date, by kind, and so on. When using metadata in a search, place the search phrase first, followed by the metadata name and property, separated by a colon:

  • Tom kind:folder — searches for any folder that has Tom in the name.
  • Sunflower kind:image — searches for images with Sunflower in the file name.
  • Dave Matthews kind:music — finds all the music on your Mac by Dave Matthews.
Spotlght search with metadata
Screen shot courtesy of Coyote Moon, Inc.
Was this page helpful?