If you need to keep something hidden from prying eyes, there are a number of ways you could go about it. One great method was described by TMO's own Sandro Cuccia in a recent article on how to use Disk Utility to create containers to keep stuff in. But what if you only need to hide something temporarily, or what if you don't want anyone knowing you've hidden it in the first place? Well, one way you could do it would be to set the file or folder's hidden flag.
Flags are metadata that tell the file system how to interact with an item. For example, when you select something, hit Command-I, and then toggle on the “Locked” checkbox to disable changes to that item, you're actually setting what's called the user-immutable flag.
I can see this if I examine that folder in Terminal:
That “uchg” text informs me that the user-immutable flag is set, so the folder is locked.
OK, OK. This is all great, you may be thinking, but what does it have to do with hiding files? Well, you can set a hidden flag on a file or a folder, but there's no way to do it through the Finder. You'll have to open Terminal (it's in Applications > Utilities), and here's where I'll mention the usual caveats about being careful with what you type into Terminal. So remember that as we continue, friends.
So once you've got Terminal open, type in the first part of the command to hide something, which is chflags hidden. Make sure you put a space after the second word, then drag in the file or folder you want to hide to make Terminal fill in the path to it:
Afterward, hit Return, and as soon as you do, the file or folder in question will vanish from the Finder as if you deleted it. It'll fool all but the savviest of Mac users!
See? It looks like there's nothing in my folder now, but it's still there. Neat!
To unhide your item, go back to the Terminal. The program saves the last commands you typed, so if you press the Up Arrow until you see your chflags hidden one, you can use the Left Arrow key to move your cursor to the proper place within the command to edit it to chflags nohidden, leaving the path to the item the same.
You can, of course, type in the whole command instead, but this can get a bit complicated with funky path names. Just remember that if your hidden item has spaces or special characters in its name, you'll want to enclose that part of it in quotes, like this:
chflags nohidden /Users/melissa/Downloads/"Path to File.txt"
Anyhow, after you unhide your item, it'll be back where you started as if nothing ever happened.
This method for hiding files is certainly not as good security-wise as creating an encrypted disk image, but with this way, someone who uses your Mac won't know anything was there to begin with. And heck, you could even hide an encrypted disk image itself, so someone would have to find what you'd hidden first and then guess your password to get in. You sly minx.