How to hide files and folders on Mac with Terminal

Hidden Folder Visible Mac

If you have some top-secret files on your Mac that you want to hide from Finder, there’s no switch or setting. However, there is a Terminal command you can use that lets you hide files or folders.

Once you hide them, they won’t display in Finder, but you can still get to them using their direct path. This keeps those items you want tucked away from plain view nice and safe.

Follow this tutorial to hide files or folders on your Mac.

How to hide files or folders with Terminal

Pop open Terminal using whichever method is easiest for you. You’ll also want to navigate to the location of the file or folder you want to hide. With both on your screen, enter the following command into Terminal but do not hit your Return key yet.

chflags hidden

Be sure to include a space after “hidden”.

Terminal Command Hide File Folder

Then, drag the file or folder from its location to the end of the command in the Terminal window. Now you can hit your Return key.

Hide Folder Terminal Mac

You may need to reopen Finder to see the file or folder disappear from view.

Unhide files or folders

If you want to reverse hiding that file or folder later on, this is also as simple as a Terminal command. Open Terminal and enter the following command with a space at that end, but don’t hit Return yet.

chflags nohidden

Drag the file or folder to the end of the command in the Terminal window and then hit Return.

Terminal Command Unhide File Folder

Your secret file or folder will now be visible in Finder once again.

If you’re interested in being able to see the files or folders you’ve hidden on Mac, check out our tutorial for showing those hidden items.

Hidden Folder Visible Mac

Wrapping it up

There are times when you have files or folders on your computer that you want to make sure no one else sees by mistake. And with a simple Terminal command, you can make it happen quickly.

Is this something that you can see yourself using down the road? If so, let us know!