Hide Folders in Mac OS X

Jan 6, 2012 - 26 Comments

Hide Folders in Mac OS X

Need to hide a folder or two on a Mac? A while back we showed you how to make invisible folders and to even how to make hidden folders in Mac OS X, but now we’re going to demonstrate how to turn an existing folder into a hidden folder.

How to Hide Folders in Mac OS X

Hiding existing folders is fairly easy:

  • Launch the Terminal, found in /Applications/Utilities/ or from Launchpad
  • Type the following command:
  • chflags hidden /path/to/folder/

  • When finished, close out of Terminal

For example, to hide a folder in my home directory named “Secrets” the command would be:
chflags hidden ~/Secrets/

The folder will immediately disappear from visibility, becoming hidden from the Finder. This includes everything contained within the folder as well, whether they are more files or other folders.

If you want to truly hide the folder and it’s contents, take an extra step and exclude the folder from Spotlight indexing. This makes sure that none of the files inside of it can be found through the Spotlight search feature in OS X.

While this hides folders from being visible in the GUI and will keep 95% of users unaware of the folders existence, keep in mind that practically anything is visible from the command line, and if an advanced user was keen or determined enough, they could probably track down the folder or its contents.

Access the Hidden Folders in Mac OS X

Now that the folder is hidden, here is how to access it:

  • From the Mac OS X desktop, hit Command+Shift+G to bring up the “Go To Folder” window
  • Enter the same path to the folder as you used when hiding it:

Access Hidden Folders in Mac OS X

You’ll now be inside the hidden folder, able to open, copy, move, and use the contained files and folders as usual.

Unhiding the Folder in Mac OS X

If you no longer want the folder to be hidden anymore, here’s what to do:

  • As before, launch the Terminal application
  • Enter the following command:
  • chflags nohidden /path/to/folder/

  • Close the Terminal

As an example, to unhide a folder on the users desktop named “Secret Folder” the command would be:
chflags nohidden ~/Desktop/Secret Folder/

Again, the folder will become immediately visible to the desktop. If you blocked the contents from Spotlight, you may want to remove it from there as well to be able to find and locate as usual.

If you read OSXDaily with any regularity, some of this will be familiar to you for good reason. The chflags nohidden command is the same thing we use to show the Library directory in OS X Lion, and accessing the folder once it is hidden is done the same way we access the user Library folder when it’s hidden as well.


Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks


» Comments RSS Feed

  1. Giannis says:

    i have hidden a file in my macbook pro like 3 years ago. and since then i ve changed laptops. know i wanna see it again so i can have it on my new laptop. But the thing is i didnt hide it using terminal or any other programm. i remeber using something from the settings on finder to hide it but cant remember what. any help?

  2. Rahul says:

    How can I add “space” in Terminal. whenever I try hiding my folder “New Files” it doesn’t work.

    Thank You

    • IT says:

      For placing spaces functionally in the terminal, use quotes or a backslash in the command string, like so: “New Files” or New\ Files

  3. calvin says:

    this is all very helpful, but when i hide the folder with everything in it the files still come up if i merely go to all my files.

  4. jahed hossain says:

    very good

  5. SyberKnight says:

    can this also be done to the root level “System” and “Library” folders?

  6. shiningjade says:

    the chflags actually works.
    however, it is unlock the damned folder, but not the contains.
    my mate gave me a single folder which contains a considerable amounts of sub folder. And each sub folder has bunch of files.

    do i have to unhide the damned files one by one ?

  7. […] to quickly hide a file from prying eyes? Just like you can hide folders, you can hide individual files too. Here is how to do this using the command line tool […]

  8. Fernando says:

    Hi, I have a usb drive that I use for work (and winxp), so I got infected with something that change the folders on the usb: all the folders are transformed into a .exe (with the virus on it) and the real folder become ‘hidden’. (The trick is if you double click on it, it will show you the files —they still are in the real-hidden folder— AND execute the virus on your pc)
    But, if use this command, I can unhidden this real folder, until I dismount this drive: next time I mount this drive, folders will be hidden —again. How can I permanently ‘nohiden’ a folder in a usb drive?
    Of course, the first thing is to ‘wipe’ my pc…

  9. Cabel says:

    The only problem is that all you have to do to see a hidden file or check if there are any hidden files is enter
    defaults write com.apple.Finder AppleShowAllFiles YES in a command line. Is there any way to make it hidden from even that?

  10. Andy says:

    In the example given to access the hidden folder you should use
    in the Go To Folder

  11. A.J. says:

    Thank you BT, that worked. OK now my problem is that Now that the folder is hidden, I can not access it.

    Per the instructions…Now that the folder is hidden, here is how to access it:
    From the Mac OS X desktop, hit Command+Shift+G to bring up the “Go To Folder” window. Enter the same path to the folder as you used when hiding it:

    When I type the file path I use to hide the folder my result says, file can not be found

    • Andy says:

      I hope you are not trying with the whole chflags thing again in Go To Folder. Just type the path of folder i.e. the chflags command without “chflags hidden”.

      After hiding the folder see the command, leave the first two words (“chflags hidden”) and copy the rest somewhere to remember. Because that is what you need to type in “Go To Folder” every time you need those hidden files.

  12. Jim says:

    Hideaway.app – much easier and faster.

  13. tripleman says:

    I don’t think that excluding the folder from spotlight is a great idea. It doesn’t take a genius to just look at spotlight’s preferences to see what you don’t want to be found.

  14. Patirck says:

    Does this work in Tiger? I have an old PPC MacMini that I’m using as a filer server with two external drives. I was wanting to hide some folders on those external volumes. When I use the command “chflags hidden /path…” it comes back with “chflags: invalid flag: hidden”.

    • er says:

      Tiger might not run Bash in the terminal by default.
      Launch terminal and type: env
      If one of the lines says:SHELL=/BIN/TCSH
      then you need to change it.

      If you need to change the shell, start Netinfo Manager in /Applications/Utilities. Then click on users and then your short username. Replace /bin/tcsh in the shell entry with /bin/bash. Save your changes, logout and back in.

      After all this it may still not work because chflags may or may not work in Tiger.
      Good luck

  15. […] Adding an additional layer of security to a hidden folder […]

  16. EldRick says:

    It’s a lot easier to just use InvisibleX…

  17. James says:

    I think a better way to keep content on your Mac private is to create a small encrypted disk image with a password. Even if someone does snoop, they can’t open it.

    On mine, I change the icon to a regular folder and name it something boring so it doesn’t stand out.

    Instructions on Apple’s site:

  18. A.J. says:

    Not able to hide an existing folder.
    If I have an existing folder in my desktop entitled AJ is this how i would type it?
    chflags hidden ~/desktop/AJ/


  19. René Dubois says:

    Excellent use of chflags

  20. Brian Yang says:

    For privacy I wish I had known about this in the days where I shared a computer with my family!

    Nowadays, this allows ultraminimalism without disabling everything in entirety.

  21. Fernando says:

    I think the last Terminal command typed should be:

    chflags nohidden ~/Desktop/Secret\ Folder/

Leave a Reply


Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site