Preventing Spotlight from Indexing Files & Folders?

Spotlight is a very ingenious "tool" of OS X, attributable in no large part to its indexing feature. Hiding various files & folders is challenging even when using various encryption applications. I am aware there is a built in option, that allows you to mark as necessary, files, folders etc that Spotlight should not index.

Are there more effective, (possibly faster methods) of hiding files & folders from Spotlight's "prying eyes", therefore in essence protecting you from other prying eyes that may have access to your Mac ?


Solution 1:

  • Create a file named .metadata_never_index inside a folder.
  • Rename folders or files so that they end with .noindex.
  • If you only want to hide files from the GUI, move them to a system folder like ~/Library/.
  • Move the files to a folder that starts with a period like ~/.fontconfig/. It doesn't remove them from mdfind queries like mdfind 'kMDItemFSName=*' -onlyin ~/.fontconfig/ though.

Related questions:

  • Exclude files from "central metadata store"
  • How to add folder to Spotlight "do not index"?
  • How can I hide the privacy tab from Spotlight.prefpane?

Solution 2:

Another take on this from a different angle is to use an App called Obscurity.

Unlike marking them as hidden files or adding them to an encrypted drive, the app itself acts as a cover for your files. It creates a mock folder that looks like a normal one, but will not open when double clicked. To be able to open it, you need to right-click the folder and select the Show Package Contents option.

enter image description here

Once installed, make sure the app’s folder is not on your desktop or you will not be able to copy files to it. Adding it to the Dock will also prevent you from adding files to it. Open the folder by right-clicking it and selecting the Show Package Contents option. If you don’t see this option, it means you’re accessing the app. Right click and select Open to bypass Gatekeeper and you will find a folder named Obscurity in the window that opens. Double clicking to open the folder will either yield an error or an empty folder. Open it via the Show Package Contents option and drag files over this folder. Close it when you’re done.

The files will not be indexed by Spotlight and will not appear in All Files in Finder. The best thing about this app is that it accomplishes its purpose of hiding your files.