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:
Excluding Hard Drives from Spotlight Index
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. This makes it really easy to prevent a hard drive from being indexed by Spotlight, because to exclude the entire drive you just have to add it to the list as shown here:
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. Additionally, if you don’t want Spotlight to run when you plug in an external hard drive, you can just add it to that list to have it not be indexed (of course, that means it won’t be searchable with Spotlight though too).
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.
I’ve added my SD card to the spotlight exclusion list, but it periodically disappears from it, presumably because I keep it dismounted most of the time, spotlight does not see it and then removes it from the list of excluded items…
So basically all someone has to do to see your “hidden” files is go into the spotlight preferences and see which folders are excluded from the search and double click on them. Is there another way to do this??
[…] advice is to drag the items to exclude from indexation into the Spotlight system preference panel exclusion list. That’s the recommended approach because it’s simple to use and easy to manage, but […]
thanks…
good job….
Great – now I understand how to exclude folders from getting indexed. Thanks.
[…] you can add anything to Spotlights Privacy list to prevent indexing of that folder or file, the obvious problem with that approach is the file or […]
[…] solution is simple enough, the same method used to exclude something from Spotlight can also be used to stop Spotlight from indexing a Time Machine drive or other external […]
[…] if an item is left under the “Privacy” list, it will exclude from Spotlight indexing […]
[…] you want to truly hide the folder and it’s contents, take an extra step and exclude the folder from Spotlight indexing. This makes sure that none of the files inside of it can be found through the Spotlight […]
problem is with indexing of cd’s, which makes it difficult to copy items until the full disk has been indexed
Thanks. I hated having duplicate items from my back-up.
FYI, ModMyI.com stole your post
I have a few folders excluded, heh