It’s hard to believe that it’s been almost 15 years since Apple first announced Spotlight as a banner feature of Mac OS X Tiger. In fact, Spotlight has been around so long that I suspect that most Mac users take it for granted, not entirely understanding just how broad its purview is and how powerful it can be at finding the stuff that’s on your Mac. Whole books could be (and have been) written about Spotlight, but let me take you through a few details that you may have never learned.
More to the search bar
Spotlight is a search engine that runs on your Mac. In the background, the Spotlight metadata engine is scanning new and changed files on your computer—and it’s not just looking for the names of your files, but is cataloging information about their contents. Spotlight indexes the text of every document it can find, and knows details about the compression formats of video files, the focal length of a digital photo, and much more.
The most common ways to search an entire Mac with Spotlight are either through the menu bar item—the magnifying glass, which you can activate by typing Command-Space—or by searching in a Finder window. If you keep it simple, just typing the name of the file or app you’re looking for, Spotlight will give you want. In recent years Apple has worked to speed up the initial Spotlight search results so it’s easy to use Spotlight to quickly launch pretty much any app on your Mac.
But there’s a lot more you can do with Spotlight. You can type words or phrases from inside documents, and it’ll find them. To find exact phrases, add quotation marks around them. You can even use
OR (in capital letters) to limit searches.
One of my most common searches is to search for an image with a specific phrase in its name. This is relatively easy to do in the Finder, via the Find command (Command-F). As you start typing a phrase in a Finder window’s search box, a drop-down menu will suggest options to apply to your query. I’ll type a search term like logo and the menu will suggest “Name matches: logo”. By selecting that option, I’m kicking off a search for files with the word “logo” in the name. But I’m not done. Once I’ve selected that search term, I type the word “image,” and the Finder offers up several different filters—all images or specific image formats. I choose Kinds: Image from the drop-down menu, and all of a sudden I’m searching only for image files with the word “logo” in their filename. It’s fast and convenient.
By default, the Finder limits searches to the current folder you’re in, but you can click the This Mac button in the toolbar of the Finder window to expand the search to your entire Mac. (If you prefer to start with a search of the entire Mac, go to Finder: Preferences, click the Advanced tab, and change When Performing a Search to “Search This Mac.”)
The Finder window can also be a powerful multi-query search tool itself. Below the Search toolbar, you’ll see a default search term of “Kind is Any.” You can modify this term to specify a file type (like Image), or change it to an entirely different term. This is a great way to search for files in a specific date range, by using the “Created date” field. And underneath the Other… option is a vast galaxy of different metadata types you can search on, including camera data like flash and focal length.
Not just the Finder
What you might not know is that other apps take advantage of Spotlight, too. Searching for text in a PDF in Preview, for example, uses the Spotlight index of your PDF. Mail’s search is based on searching individually downloaded email messages within a hidden folder. (Which is why you can also use Spotlight to find Mail messages, incidentally.)
This can lead to some quirky behavior, including something a friend ran into the other week. He was searching for text in a bunch of PDFs from within Preview, and coming up empty—even though he knew the text he was searching for was there. The fix turned out to be a pretty obscure one: I had him open the Spotlight pane of System Preferences, click on the Privacy tab, and drag his folder full of PDFs into the tab. Then I had him remove the folder and wait a moment for Spotlight to re-index all the files in that folder.
This solved the problem. When in doubt, adding a folder to the Privacy tab (which is, of course, also useful if there are items you never want to show up in Spotlight searches) is a quick way of erasing Spotlight’s index of a particular corner of your Mac. When you remove the disk folder from the Privacy tab, Spotlight cranks up its background processes and re-indexes everything. You’d be surprised how often this is the way to solve a frustrating series of failed searches.
I’ve also found Spotlight a helpful companion for files I store on cloud services. Since Dropbox works by syncing my files to my Mac, Spotlight will index them and make them searchable just as it would any other file. But because I also use Google Drive for some documents, I’ve installed Google Backup and Sync, an app that “syncs” my Google Drive with my Mac.
I used sarcastic quotes in that previous sentence because Google doesn’t really download the contents of Google Docs and Google Sheets onto my Mac. Instead, it downloads empty files that have the names of my cloud documents, and when I click on them, the real documents open in my web browser. Because the real text of the documents doesn’t reside on my drive, I can’t search within them—but I can still search on their filenames. I use search all the time to open up Google Docs and Google Sheets files directly.
Spotlight is a powerful database of files, but Apple’s attention to the Spotlight interface is, er, spotty. If you really want to take control of your file searching on macOS, it’s worth considering the $34 utility HoudahSpot, recently updated to version 5.0. HoudahSpot offers a flexible, friendly front-end to searching the Spotlight database. If I’m being honest, HoudahSpot is the Spotlight interface that would be built into macOS if Apple had continually improved Spotlight over the last decade and a half… but it hasn’t.
This week John Voorhees at MacStories had a good overview of HoudahSpot 5, which is worth a read. If you find yourself getting frustrated by the limitations of Apple’s Spotlight interface, HoudahSpot will make you feel a lot calmer.