Hiding Files and Folders in OS X Finder

Multithreaded JavaScript has been published with O'Reilly!

OS X, being a unix based OS, will hide files and folders whose name begin with a period. However, the Finder utility (and dialogs which use the OS features like save dialogs) also support meta information for hiding files (similar to Windows). This is useful if you want to hide a folder but you don't want to have the name change. OS X 10.7 recently started doing this with the Library folder in your home directory.

Hide Files in Finder
Hide Files in Finder

To enable this feature, you'll need to open up Terminal Applications | Utilities | Terminal and type the following command:

chflags hidden

Then, you can drag and drop a file onto the terminal window (which will put the files path after the command). Then press enter and the file will disappear. If you want to make a file visible, you can do the same process but using a different command, although it may be harder to find out where the folders are hidden.

chflags nohidden

Easy, huh? I use it to hide useless folders left around by applications originating from the Microsoft world which love to clutter the users Documents directory. E.g. Microsoft Office and a bunch of Steam games.

Also, you can press Cmd + Shift + G in Finder to open a directory you know of which is hidden. This is useful if you wanted to, say, hide files on your computer from other people which use the same account.

Open Hidden Directory in Finder
Open Hidden Directory in Finder

Tags: #macos #cli
Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.