Three Ways to Prevent Spotlight from Indexing Items on Your Mac

Spotlight, introduced by Apple with OS X 10.4 Tiger, is a powerful system tool that allows for fast and easy searches of your entire Mac and any attached drives. For single users on secure Macs, it’s one of the best ways to find your files, app data, and even to launch applications. But if you share your Mac with others, or frequently use it in a public place, you may wish to temper Spotlight’s reach. Here are three ways to prevent Spotlight from indexing items on your Mac.

Three Ways to Prevent Spotlight from Indexing Items on Your Mac

Turn It Off

First, and most bluntly, you can turn Spotlight off entirely. Note that this will also affect your ability to search within most of Apple’s applications, such as Mail and Finder, as they rely on the same Spotlight foundation that we’re about to kill.
Open up Terminal from /Applications/Utilities and enter the following command to kill Spotlight entirely (you’ll need administrative privileges to execute the command):

sudo launchctl unload -w /System/Library/LaunchDaemons/

You’ll immediately notice that Spotlight is suddenly impotent, and returns only the generic “Search the Web” and “Search Wikipedia” options for each inquiry. In the screenshot below, you can see the result of a search with the default settings (left), and after entering the above command (right).

How to Manage Spotlight Mac OS X

So your files are safe from unauthorized searches but, as we mentioned above, you’re also no longer able to search for emails in Mail, or files from within Finder. If you find that this step was a bit too much, enter the following command to restore Spotlight’s functionality.

sudo launchctl load -w /System/Library/LaunchDaemons/

Note that after reenabling Spotlight, it will need to reindex your drive(s), a process that may take a while depending on the size of the drives and the number of changes that occurred since you disabled Spotlight. You can measure the progress of the rebuild by clicking on the Spotlight icon in the menu bar.
Prevent Spotlight from Indexing Items on Your Mac Rebuild

Exclude Items Using Spotlight’s Preferences

Instead of turning the whole thing off, you can simply exclude certain drives or folders from Spotlight by using its Preferences. Head to System Preferences > Spotlight > Privacy. Here you can choose which drives or folders to exclude from Spotlight’s index (note that yours may be empty if you only have a single drive in your Mac).
Prevent Spotlight from Indexing Items on Your Mac Privacy Preferences
Adding a file or folder to this list will exclude it and its contents from Spotlight, meaning that they won’t appear during a Spotlight or Finder search. To add items, you can either click the plus icon and navigate to the drive or folder you want to exclude, or you can simply drag and drop drives and folders into the list.
Prevent Spotlight from Indexing Items on Your Mac Privacy Preferences
To remove items from the list, and thus make them searchable by Spotlight once again, select the item and press the minus icon at the bottom-left side of the list.
This is an easy way to manage Spotlight’s reach, but it includes one critical flaw: anyone with access to your user account can simply head to Spotlight’s Preferences and see exactly what you’ve chosen to hide. It’s like a treasure map to your private files and secrets. Thankfully, there’s still one final option.

Manually Hide Folders Using a Special Extension

The previous methods to prevent Spotlight from indexing items on your Mac covered both folders and drives, but this trick only works with folders and files. To prevent a specific folder or file from being indexed by Spotlight, add a “.noindex” extension to it.
As an example, we have a folder on our Desktop called “Private Documents” containing a file called “Q3 Financial Results.rtf.” By default, searching for this folder or any file within returns a result with Spotlight.
Prevent Spotlight from Indexing Items on Your Mac noindex extension
Now we’ll add “.noindex” to the end of the Private Documents folder (“Private Documents.noindex”). The folder and its contents are immediately excluded from Spotlight and any searches fail to return results from the folder.
Prevent Spotlight from Indexing Items on Your Mac noindex extension
The benefit of this approach is that these manually excluded items do not appear in the Privacy tab of Spotlight’s Preferences, meaning that those snooping around won’t be able to easily locate your private or sensitive data. In our example, the “hidden” folder was on our desktop, which would still be easy to find by just looking at it. In practice, of course, you’ll want to stick your “.noindex” folders somewhere out of plain sight.
As we mentioned above, this technique works with both folders and files, but we recommend putting your sensitive files into folders and then applying the “.noindex” extension only to that top level folder. This not only saves time (you don’t have to manually change the extensions of multiple files), it also prevents issues with standard application file extensions.
Most users will best served by using a combination of methods 2 and 3: excluding cloned backups via Spotlight Preferences and hiding a select few personal documents with “.noindex,” for example. Regardless, Spotlight is a very powerful tool and it’s good to know that users have the ability to reign it in when necessary.

6 thoughts on “Three Ways to Prevent Spotlight from Indexing Items on Your Mac”

mikedvzo says:
You cannot disable spotlight for Timemachine Volumes even if you do it will have no effect since it is required by the system to track the files and index the Backup.
john kerns says:
is there a way to add a user’s library to spotlight? i can’t figure out how to do it since it is hidden. i have to press OPTION in the GO menu.
David Arnold says:
I tried this, but here is what I got, I will paste below… I am the Admin and my PW is correct.
Any help would be greatly appreciated!
“Last login: Wed Sep 28 10:01:44 on ttys000
DAs-Mac-Mini:~ DA$ sudo launchctl unload -w /System/Library/LaunchDaemons/
sudo: /var/db/sudo writable by non-owner (040775), should be mode 0700
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type “man sudo” for more information.
To proceed, enter your password, or type Ctrl-C to abort.
/System/Library/LaunchDaemons/ Could not find specified service
DAs-Mac-Mini:~ DA$
Chacapamac says:
Thanks, Spotlight, anyway in Moutain Lion is useless and was crashing my computer (freeze) when searching external disk. I use “Find Any Files” really advanced search in seconds without the crappy problems
Tom Martin says:
If you completely disable spotlight, the app store will no longer be aware of when apps need to be updated as that is how that mechanism works. It took me awhile to figure that one out.
Smile it is almost Friday! says:
So what is the best way to manually update apps? I refuse to re-enable spotlight.
megadroid says:
4th way: create a new file called .metadata_never_index at the root of any drive. My favorite way whenever I get a new drive. It also survives unmounts (sometimes, drives added to the Spotlight Privacy pane, are lost when they’re unmounted).
Vince says:
How do you undo this afterwards? I did it, then decided only to index a few dirs, so I copied it in some folders and removed it from the root. But now it won’t index anything anymore…
megadroid says:
To force re-indexing, add your drive to Spotlight’s Privacy tab and remove it or enter in Terminal
sudo mdutil -E /Volumes/[VolumeName]
where [VolumeName] is your actual drive’s name.

Comments are closed.

Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.

Todays Highlights
How to See Google Search History
how to download photos from google photos