How to Exclude Hard Drives and Folders from Spotlight Index in Mac OS X
Spotlight is a wonderful feature of Mac OS X that lets you quickly find literally anything on a Mac by search, that includes files, apps, folders, emails, you name it, and Spotlight will find it, but sometimes you don’t want everything to be indexed. Whether that’s an external backup drive, a scratch disk, a directory of temporary items, or just a private folder with files you don’t want easily found through the search function, you’ll find that excluding drives, files, and directories from Spotlight is actually very easy.
Exclude Specific Items from Spotlight Indexing
This is by far the simplest way to universally exclude something from Spotlight searches and it works in all versions of Mac OS X:
- Launch System Preferences from the Apple menu and choose the “Spotlight” preference panel
- Click on the “Privacy” tab
- Drag & drop folders or drives to exclude from the Spotlight index, or click the “+” plus icon in the corner to manually select hard drives or directories
Items dragged into the Spotlight Privacy window will then appear as a list within the Privacy section:
Think of the Privacy tab as an exclusion list, anything appearing in this list indicates that it is now excluded from the Mac OS X search function:
Whatever folder or drive in that list is effectively hidden from the Spotlight index, making the contents not be indexed, and not appear in any file searches, whether it’s from the primary Command+Spacebar Spotlight menu, or Finder-window searches. This is a much better approach than disabling Spotlight if all you want to do is hide certain files from prying eyes.
Re-Adding Items to Spotlight Index
If at any point you want these items to be reindexed and reincluded within Spotlights search results, all you need to do is highlight them in the privacy tab and delete them with the Delete key or by hitting the “-” minus button in the lower left. Removing items will trigger the mds and mdworker processes to run again, and when finished the once excluded files will be searchable in Mac OS X again.
On a side note, because excluding items and then reincluding them also causes that directory or drive to be completely reindexed, this can be a helpful troubleshooting tip if you’re running into location specific problems with Spotlight, particularly if you find a file or folder isn’t showing up when it should be.