Hide Anything from Spotlight in Mac OS X with the Library Folder

Jul 21, 2012 - 7 Comments

Hide anything from Spotlight with the Library Folder

Though 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 folder is shown within the Spotlight control panel in Mac OS X, making it easy for someone else to find the excluded items.

Another way to hide a file from Spotlight is to drop it in the user Library directory. This makes it invisible to the vast majority of people, and it also prevents the file from being indexed by Spotlight despite not being directly excluded. This works because Spotlight does not index the user Library directory which is typically just filled with preference and cache files.

  • Get access to the Library folder in OS X, using Command+Shift+G to ~/Library/ is my preferred method
  • Drag & drop a file or folder in the users Library directory
  • Optional: add a layer of obfuscation by creating a boring sounding directory in ~/Library/, such as “Webkit Data”, and store the file or folders to hide in there

You can immediately confirm the file or folders contents are hidden from Spotlight by hitting Command+Space and entering the files name, it will no longer be found.

Just remember that if you keep the Library folder visible then your hidden file or folder may be easily found by prying eyes, though the nonsensical folder name may deter that. You can always follow one of the many other methods we’ve covered to hide things in OS X, ranging from hiding files with chflags, by placing a period in front of the folder name, and using visually invisible folders. Ultimately the safest approach is to password protect an encrypted disk image and store private documents and data there.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Mac OS X, Tips & Tricks

7 Comments

» Comments RSS Feed

  1. clod says:

    Spotlight DOES index the user Library folder. Just search via Finder click + and select “System Folders – Are included”.

    As for the Spotlight excluded folder being visible in the Spotlight System Prefs panel, simply use a custom transparent, thus invisible, icon. And a few spaces (” “) to name the folder. Now you can put it in the exclusions and nothing shows…

    Then “chflags hidden” the folder and it’s nowhere to be seen….

  2. Theo Vosse says:

    I’ve always excluded the Library from Spotlight. It’s just not interesting.

    However, if I wanted to find someone’s secrets on a Mac, the first thing I’d look for are files and folders excluded from Spotlight or with hidden flags. It’s *not* a good protection.

  3. Joe says:

    Another way to accomplish this, particularly if you don’t want a bunch of random stuff in the Library folder, is to use Disk Utility and create an encrypted disk image for your files (you can even make it password protected), and give the image an innocuous name. Spotlight won’t see the files contained in the image. You could, of course, do double duty and stick the image in the Lib folder as well. ;)

  4. Lauri Ranta says:

    clod is right; files in ~/Library/ are indexed but they’re just not included in the Spotlight menu or Finder by default. Another way to search for them would be to use mdfind.

    Spotlight does exclude folders that start with a period though, so a slightly better option would be to move the files somewhere like ~/.fontconfig/ or just put them in any other folder that starts with a period.

    Of course someone who really wanted to find them could just use http://apps.tempel.org/FindAnyFile to find all movie files or something.

  5. Hans says:

    I’m going to wonder all day now, what movie is contained within “Don’t watch this secret movie.wmv.”

  6. NSGod says:

    If you want to disable indexing for a particular folder, just add “.noindex” to the end of the folder name.

    Mark Douma

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates