There are two ways of making files invisible on your Mac. Neither is bulletproof from a security standpoint, and anybody with know-how would be able to uncover them in seconds. But for quietly hiding a file or two for a short period, they’re worth considering.
Hiding Files via Unix: Your Mac’s operating system, OS X, is actually a version of Unix at its heart. In Unix, you can make a file invisible by adding a full stop (.) in front of its filename, and this works on Macs too. This means the file won’t show up in Finder windows, in file open dialog boxes, or on the desktop. Those browsing at the command line won’t be able to see it unless they specifically request to view hidden files (that is, ls -a).
For example, typing a filename of .document.docx when you’re saving a file will render it invisible. You’ll probably be warned that putting a full stop in front of a filename is reserved for system files, the type of file this technique is typically used to hide, but you can still choose to save the file.
Hiding Files So Mac Apps Can’t See Them: The chflags command can be used to hide files so they don’t show up in graphical user interface (GUI) applications. However, they’ll still be visible if anybody browses files using a Terminal window.
To hide files in this way, open a Terminal window (open Finder, select the Applications list, and then in the list of applications double-click Terminal within the Utilities folder), and use the chflags hidden command, specifying the file or folder name immediately afterward. For example, to hide secret.doc, type the following:
??chflags hidden secret.doc??
To unhide the file so it’s visible via GUI software again, use the chflags nohidden command:
??chflags nohidden secret.doc??
Viewing Hidden Files: So, if a file is hidden, how can you see it in order to open it again? In expanded file open/save dialog boxes within apps, hitting Shift+Command+. (full stop) will display hidden items in the file listing. Hitting the key combo again will hide them. However, be aware that you’ll suddenly see lots of system files that are hidden in this way. (Steer clear of these—don’t delete or open them.)
The only way to see hidden files in Finder windows is to activate a secret setting that shows them alongside other files. This will cause them to always be visible within Finder windows and on the desktop, although hidden files will have a washed-out appearance to indicate their status. Open a Terminal window, and type the following:
??defaults write com.apple.finder AppleShowAllFiles -bool TRUE;killall Finder??
Even after making this change, you’ll still have to hit Shift+Command+. within file open/save dialog boxes to see hidden files.
To revert to hidden files being hidden within Finder, type the following:
??defaults delete com.apple.finder AppleShowAllFiles;killall Finder??