Exclude directories and file types from Spotlight search

Exclude directories from Spotlight

Your Mac’s Spotlight application might be one of the most underrated part of the OS X ecosystem. Spotlight indexes all the content on your Mac, making it simple to find documents and data that might be buried deep within your file system.

It’s so fast, I’ve started using it to quickly pull up contact cards. It’s so much more efficient than starting up the Contacts app and digging through people’s names.

However, one problem is that Spotlight will index virtually everything on your hard disk. In my use case, I keep website backups and development sites on my hard disk, resulting in a large number of images, HTML and CSS files tucked away. These tend to show up – irritatingly – in different types of Spotlight search.

So, I said to myself, Apple must have a way to exclude directories so that unwanted results don’t keep showing up. And they do – it’s built right into the app’s Privacy settings. Here’s how to banish whole folders and drives from Spotlight forever:

  1. Open up your System Preferences applet and browse to the Spotlight settings.
  2. Click on Privacy. If this is your first time in this screen, a blank pane should appear. Use the little + button to add folders to the exclude list. It’s also possible to drag folders directly into that area from Finder, which is a neat little extra trick.

That’s it. Honestly. Here’s a screenshot:

Exclude directories from Spotlight

Excluding specific file types from Spotlight

Spotlight-File-TypesHere’s a quick bonus – if you don’t want certain types of files showing up during a spotlight search, go to the Search Results pane in Spotlight preferences. Uncheck the file types you don’t want to see.

For extra fine-tuning, you can drag file types up and down the list to change their priority in Spotlight results.