The separation of files by user accounts in OS X negates much of the need for hiding files and folders, at least for security purposes; however, there are times when you may still want to hide a file or two.
Unfortunately, hiding a file makes managing it much more tedious, since you can no longer access it directly in the Finder.
The easiest way to manage individual hidden files when you need to access them is to toggle the Finder's ability to reveal hidden files, instead of making specific files visible again. For multiple hidden files, there's an even easier method.
But first, to hide your file. There are two ways to hide files in OS X. The first is to rename them so they have a period as the first character in the file name, and the second method is to set a special attribute on the file called a Finder flag that tells the Finder to not display the file under normal browsing circumstances.
To invoke the Finder flag on a file, perform the following steps:
- Open the Terminal utility and type the following text, followed by a single space:
- Drag the desired file to the Terminal window, which should automatically add the file's path to the end of the command.
- Press Return, and the command should run and hide the file.
To undo this process, re-enter the exact same command--you can press the up arrow key in the Terminal to reveal the last command--and change "hidden" to "nohidden" (you will have to use the arrow keys to navigate the cursor).
You can reveal any hidden files in the Finder by running the following command (copy and paste it into Terminal):
defaults write com.apple.finder AppleShowAllFiles True;killall Finder
To hide files again, repeat the command, but change "True" to "False."
While you can use these Terminal commands to reveal hidden files in the Finder, there are some third-party utilities that can do this more conveniently, including Show Hidden Files, MacPilot, and OnyX.
Regularly unhiding and rehiding individual files or toggling the Finder in this manner can be a lot to remember, especially if you wish to regularly show and hide files in different locations on the hard drive. Because of this, an easier way to manage files you wish to keep hidden is to sequester them all in one hidden folder and then show and hide that folder as needed. Here is how to set this up:
- Create a folder at the desired location. For example, create a folder called "HiddenSecrets" in your home directory.
- Run the procedure above to hide the folder with Finder flags. So, in our example, you would run the following in the Terminal:
chflags hidden ~/HiddenSecrets
At this point the folder is now hidden, and you have set up a single location that will keep any file within it hidden, so to access the hidden folder you can take advantage of the Finder's "Go to Folder" command:
- Open a Finder window and navigate to the parent folder of the hidden directory (in our example this is the home folder).
- Select "Go to Folder" in the Finder's Go menu, or press Shift-Command-G.
- Enter the folder name in the field (in the case of our example you would enter "HiddenSecrets").
Doing this will show the hidden folder in the Finder without revealing all hidden files on the commputer and without restarting the Finder. You can now copy files to and from the hidden folder. Additionally, the folder will remain hidden, so there is no need to toggle commands to reveal and hide it. Instead, just close the Finder window that is showing the folder and it will disappear until you go to its parent folder and use the Go menu again.