Pin Me

Three Ways to Hide Files in OS X

written by: CompuDav•edited by: Michael Dougherty•updated: 12/8/2009

We've all got some files we'd like to hide. Whether it's a financial document detailing your net worth, a mockup for a client that cannot be seen by other people, or some other file that you don't want some pesky user seeing, hiding any file in OS X is extremely easy if you follow this article.

  • slide 1 of 5

    Shhh... It's a Secret

    Most of us have sensitive information that we'd prefer to hide from casual users. For example, parents might like to hide their financial documents from their children and, at the office, you might want to hide clients' files to ensure that the casual user doesn't browse by and notice them.

    With OS X, hiding files is an incredibly simple task. We'll show you three of our favorite methods in this article: the "dot" method, the SetFile method, and the DMG method. The first two ideas will hide your files in Finder but will not perform any encryption, meaning that anyone can find these files with a few simple Terminal commands. The last method will encrypt your file(s) and ensure that no-one sees them.

  • slide 2 of 5

    The "Dot" Method

    Many Mac users are unaware that there are always hidden files in every folder. For example, every folder has a .DS_Store file which tells the operating system how to display the folder to the user. Another, largely unused, hidden file in every folder is .localized.

    As such, our "dot" method is really quite simple - Finder does not display any file that starts with a "." (minus quotation marks) so renaming filename.ext to .filename.ext will make it invisible to people casually looking at the folder. Should you wish to find the file again, you can get a list of all hidden files in a directory by typing "ls -la" at the command line. Finally, use the "mv" command in Terminal to make the file visible again in Finder. For example, entering "mv ./pathtofile/filename.ext /pathtofile/filename.ext", will let you see the file again in Finder.

  • slide 3 of 5


    If you have the Xcode tools installed, there's a nifty tool called SetFile on your machine. SetFile is designed to let developers adjust the settings of any attributes associated with a file, such as its creator, date made, or type.

    However, we can use SetFile to make it invisible in Finder. Simply go to Terminal, cd to your directory, and type "SetFile -a V filename.ext". To make filename.ext visible again, simply type "SetFile -a v filename.ext". A lower-case v in the command tells Finder to display the file, whereas a capital V tells Finder to not display the file.

  • slide 4 of 5

    Make a DMG

    A clever way to hide sensitive documents is to put them in an encrypted DMG image. That way prying eyes can't see the files included on the disk without knowing the correct password. To make an encrypted image, follow these steps:

    1. Start Utilities->Disk Utility
    2. Select "New Disk Image" on the toolbar.
    3. Change the name and size to your liking and set the encryption to either 128-bit or 256-bit. Both will keep the casual user out of your data, and using either encryption method will stop most hackers. Leave the remaining settings alone.
    4. Choose a save location and click create.

    When you open your disk image you will be prompted for a password each time. Be careful not to save the password to the keychain as that would defeat the purpose of encryption in this case. If you'd like an extra level of security, use one of the tips above to hide the DMG so that no-one can find it.

  • slide 5 of 5


    Three unique ways of hiding files were examined in this article: adding a leading dot to the file, using the SetFile command-line utility, and making an encrypted DMG into which the files can be copied. If you're concerned about hackers or tech-savvy people viewing these files, I would strongly recommend that you create an encrypted DMG and hide it using one of the two methods listed above. This ensures that most people won't know the file exists, and even if they do, they won't be aware of the password. Without a doubt, OS X makes it extremely easy to hide and protect sensitive information, provided that you follow one of the steps above.