Hide any File or Folder by making it Invisible to the Mac OS X Finder

Aug 11, 2009 - 18 Comments

This is a really cool tip that should be particularly useful to those who share their mac with other people.

I use this trick all the time to hide my personal files before my roommate uses my computer, and it’s easy to do if you know how but it’s unlikely that another user will even think to look in a directory via the Terminal to find the file.

Make a file or folder invisible in Mac OS X Finder

setfile -a V testfile.txt

Poof! Like magic, the file or folder is no longer visible via the Finder GUI, but don’t worry your files are still there and you can find them via the command line and will show with an ls command. If you want to make your files and folders visible again, use this command:

Make a file or folder visible again in Mac OS X Finder

setfile -a v testfile.txt

Now the file/folder will be visible again to the Finder, cool huh?

Note: setfile is a command line utility included in Apple’s Developer Tools, which is a highly recommended optional install included on any Mac OS X install/restore CD/DVD and also available as a rather large download from Apple’s Developer center. If you want to use setfile without installing Developer Tools you can try this trick on macosxhints.com. Thanks for pointing this out Albert!

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 Command Line, Security, Tips & Tricks, Utilities

18 Comments

» Comments RSS Feed

  1. Albert says:

    ‘setfile’ is not a Leopard command, is it?

  2. ‘setfile’ is an utility from Apple’s developer’s kit and is not included in default Leopard install.

  3. Chris B says:

    Wonders if this command can be put into an AppleScript, thus more easily called when one wants to hide/show a certain folder. (And name it something that doesn’t reveal it’s true operation).

    An even better way to hide folders from roommates is to set up a ‘Guest’ account so others can use your computer without prying into your files. Simply logging out of your account or set up a screen saver password seems easier than pulling up the terminal, etc.

  4. Benoit Garbinato says:

    It’s SetFile, not setfile…

  5. Benoit Garbinato says:

    It’s SetFile, not setfile…

  6. Benoit Garbinato says:

    It’s SetFile, not setfile…

  7. Benoit Garbinato says:

    It’s SetFile, not setfile…

  8. Bobby says:

    If I don’t want to share certain files, I use Disk Utility to create an encrypted disk image, then, because no-one likes stuff being kept from them (“I thought you trusted me etc etc?”), I copy-paste a folder icon onto the dmg and give it a system-file-esque sort of name with the extension hidden.

    It ends up effectively being a password-protected (yet totally average looking) folder, and there’s not much chance of accidentally leaving it available to others (it clearly mounts on the desktop with the drive icon and only needs ejecting when you’re done with it)

  9. Nevil says:

    I have installed Snow Leopard and have tried typing this SetFile command. It is not an actual command as far as I can tell.

  10. James S. says:

    Nice little trick! If one uses this on a folder, one can still access it in Finder using the “goto” command (Shift-Cmd-G) and typing the path.

  11. […] which allows you to set any directory or file as invisible, you can read more about hiding files and folders with setfile in Mac OS X, but the limitations on visibility are practically identical to the above technique: file is […]

  12. foo says:

    Rename a file/folder with a “.” as first character.

    Finder does not allow this, so with the Bash:

    mv foo.txt .foo.txt

  13. Harpiest says:

    my problem is bit different
    i’ve dual partition with windows
    i’ve hidden some files in windows
    n i want to upload it from mac
    i cant find it on “Choose Files” dialogue tab
    and its doesn’t have a ” . ” on initial file name but it still hidden
    how to make it become visible??

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