Spotlight

Spotlight is a system-wide desktop search feature of Apple's OS X and iOS operating systems - wikipedia

Spotlight in OS X Yosemite showing Wikipedia article on Bugatti Veyron. Icons of Safari were replaced with Firefox icon. (it is possible to change the default web browser in OS X, so it's accurate.) - wikimedia

Spotlight also offers quick access to definitions from the built-in New Oxford American Dictionary and to calculator functionality. There are also command-line tools to perform functions such as Spotlight searches.

It also allows the user to narrow down searches with creation dates, modification dates, sizes, types and other attributes.

In addition, specific words in documents and in web pages in a web browser's history or bookmarks can be searched.

# Tips

Every Spotlight query is an AND search by default. This means the program looks for files containing all the words you type. For instance, if you enter time machine, Spotlight seeks out anything that contains both the word time and the word machine.

You can narrow down the search results by using quotation marks—this tells Spotlight that the words must appear next to one another. If you type "time machine", Spotlight will look only for files that contain the exact term inside the quotation marks.

You don’t even have to use both quotation marks; typing only the first one tells Spotlight that the words following it must appear together. However, if you want to add more search terms after the phrase, you’ll need to add the closing quotation mark.

# Boolean search

One of the biggest additions to Spotlight is support for true Boolean searching, which uses logical operators (AND, OR, and NOT) to pinpoint results. For instance, if you type "time machine" OR morlocks, you’ll get references to Leopard’s backup tool, as well as any files related to H. G. Wells’s fictional species. To find files that include time machine but make no mention of H. G. Wells, type "time machine" NOT Wells. When you perform a Boolean search, make sure to type operators in capital letters.

# Search for File Names

If you know the name of the file you’re looking for, you can limit your search to file names by using the name: keyword. For instance, when you type name:machine, Spotlight will find only files that contain the word machine in their names (though your search results may also turn up bookmarks, iCal events, and other items). As with regular search queries, you’ll need to use quotation marks to identify phrases—for example, name:"time machine".

# Rebuilding an index

Individually Reindexing Selected Files in Mac OS X In rare cases, Spotlight can miss a file during index, so rather than reindex an entire drive you can also manually add an individual file to the search index with the mdimport command:

mdimport /path/to/file

The mdimport command can be used on directories as well, if a specific directory needs to be reindexed or was somehow left out of the spotlight search index.

# Reindex a drive

To get the manual rebuild started, open up Terminal on your Mac (Applications > Utilities > Terminal). Copy/paste the following command, then hit Return.

sudo mdutil -E /

You can force spotlight to reindex specific folders if you only want the results updated from a single location (eg your documents folder):

sudo mdutil -E /Volumes/Macintosh\ HD/

sudo mdutil -E /Volumes/[DriveName] In the above command, you can either manually enter the drive name, or type in just the following portion of the command:

sudo mdutil -E

Then drag and drop a drive from the Finder on your Mac into the Terminal window. This will automatically enter the drive path and name for you.

# mdutil

You can view a full list of flags available in mdutil with the command:

man mdutil

# See also * Create queries in Spotlight - macworld.com * Spotlight tips - thexlab.com * Manually reindex a folder - jonathansblog.co.uk

Spotlight is a system-wide desktop search feature of Apple's OS X and iOS operating systems - wikipedia

All words passed in a query string to mdfind are implicitly ANDed together. That is, "invoice apress" means both words must appear. Spotlight allows other Boolean operators as well:

Here are some commonly used spotlight attributes that you can use with mdfind:

mdfind is the built in command line tool that utilises the spotlight search engine on macOS. Every Spotlight query is an AND search by default. It is surprisingly powerful.

When you type in your search terms, Spotlight looks for even a partial match at the beginning of a word. So, when you search for phon you’ll find phone, phony, and phonatory, but not symphony.