BEGIN TYPING YOUR SEARCH ABOVE AND PRESS RETURN TO SEARCH. PRESS ESC TO CANCEL

How to hide files and folders in OS X Snow Leopard

By default, OS X Snow Leopard doesn’t reveal its full power or potential to the end user very easily.  You kind of have to dig around to do some pretty basic things that Windows would let you do via a few right-clicks, etc.  The other frustrating thing with OS X is that there are a million ways to do effectively the same thing.  One of those pain-in-the-ass scenarios is simply hiding (or unhiding) a file or folder in OS X.  If you search the internet for “hide file OS X” you literally get 1000 solutions ranging from downloading third-party utilities, to having to download and install the Developer Tools, etc.  Today I present to you a very simple way of quickly hiding and unhiding files and folders, without the need to download and install any other crap!  Here’s how you do it, the easy way!  Let’s get started.

To hide a folder, add a period (“.”) to the beginning of the folder name.  Yes, that’s it!  But wait, OS X won’t let you do this via the Finder (clicking on a folder and simply renaming it), so you’ll have to do it from the terminal.  Ugh. I know, I hate it too.  But trust me, this one is easy!  Open up the Terminal app, and navigate your way to the path that contains the folder you want to hide (in this example, I’ll be navigating to the root of my Macintosh HD (note that the “\” is an escape character sequence, which will allow you to navigate to a volume or folder without having to use quotes around names that contain spaces):

cd /volumes/Macintosh\ HD/

Finder with CrapIWantToHide
Finder with CrapIWantToHide

Ok, so now we are at the root directory of our internal Macintosh HD.  Let’s suppose you had a folder in here called “CrapIWantToHide”, to hide this folder, just use this command to move this folder into a new hidden version of itself:

mv CrapIWantToHide .CrapIWantToHide

Put simply, you are executing the Move command, specifying which folder to move, followed by the new folder name you are moving it to.  Note that this won’t hide the contents of the folder, just the folder itself!

Also note that if you navigate to the root Macintosh HD via Finder, your folder has disappeared (because now it is hidden)!  To navigate to this folder via Finder (so that you can see its contents), use this keyboard sequence with Finder selected:

command + shift + G

Go To Folder
Go To Folder

This will open up the “Go to the folder:” dialogue where you can type in your new hidden folder path:

/Volumes/Macintosh HD/.CrapIWantToHide

Boom! – it takes you straight to the inside of your newly hidden folder (note that you don’t need the “\” escape character when entering the folder path in Finder’s “Go to the Folder:” dialogue.).

If you ever want to unhide your folder again, just do the same process but reverse the two folder names in the mv command:

mv .CrapIWantToHide CrapIWantToHide

Done.  Universe restored to normal.

Ok, so what about files?  This one is slightly trickier, but not really.  Instead of adding a “.” to each file name (and using the mv (Move) command), we are going to use another Terminal command instead to set an attribute of the file that OS X Snow Leopard provides (and the Finder understands as well, so it won’t show the hidden file once this attribute is set).

Open up the Terminal app, and navigate to the folder containing the files you want to hide.  Using our trusty example from above:

cd /volumes/Macintosh\ HD/CrapIWantToHide/

From here, we can hide all the files in the directory via the “chflags” command.  Here is how to use it:

chflags hidden <filename>

So for example if we had a text file in this directory that we wanted to hide (called “MySecrets.txt”):

chflags hidden MySecrets.txt

Bam!  The file is now hidden.  Visit the folder yourself via Finder, and verify it is now “gone”!  So how do we unhide a file?  It’s simple… instead of specifying “hidden” via chflags, use “nohidden” instead:

chflags nohidden MySecrets.txt

Viola!  Back to normal, and the file is now visible in Finder again.  Chflags is a powerful command that you can use very quickly to hide and unhide files in batches as well, using your old Unix/DOS skills.  For example, say we wanted to hide all the “jpg” files in a certain directory:

chflags hidden *.jpg

Boom!  All the jpeg files in the folder now have the “hidden” attribute, and won’t show up in Finder anymore.

Congratulations, and enjoy these simple tips!

  • Justin

    It should be noted that .HiddenItem really isn’t the same as just setting a hidden flag on the filesystem entity. This effectively changes its path and, if you’re like me and trying to find a way to suppress the display of some of the unnecessary skeleton home directory folders, moving/removing the folders in question can lead to some really hairy desktop behavior.

  • website design in chennai

    nice work, thanks for ur information

  • http://freedom2blog.com Jatin Sapra

    Thnx fr ur appreciation, means a lot!