How to

Hide Files and Folders on Mac Using Terminal

Written by Hassan Abbas

Hide Files and Folders on Mac: If you have some hidden files on your Mac that you want to hide from Finder, there’s no setting or switch. However, there is a Terminal command you can use that lets you hide files or folders.

Once you hide them, they can’t display in Finder. But still, you can get them using their direct path. Follow our guide to hiding files or folders on your Mac.

If you want to make some files or folders disappear, there are many methods you can use to hide files and folders on your Mac. This can’t encrypt the files, but it will make them invisible while browsing in Finder.

How to Hide Files or Folders with Terminal

A pop-open Terminal method is very easy for you. You 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 press your Return key yet.

chflags hidden

Make sure to include a space after “hidden”. Once the path appears in the Terminal window, hit “Enter” to set the hidden flag.

Then remove the hidden flag and change the command to chflags nohidden instead.

Also, reopen Finder to see the file or folder disappear from view.

Hide with a Period

Files or folder names starting with a period (“.”) are automatically hidden in Finder. You can also use Terminal to add a period to the start of any file or folder’s name. Hiding the file from a casual view.

Step 1:

First, Open Terminal.

Step 2:

Now navigate to the folder having the file you want to hide in Terminal using the command.


Step 3:

To move the file you want to hide from its current name to one starting with a period using  mv a command, like so:


It’ll immediately hide the file. To reverse this process, just enter the command, like so:

Unhide files or folders

If you wish to reverse hiding that file or folder, later on, this is as simple as a Terminal command. Simply open Terminal and input the following command with space at that end, but don’t press Return yet.

chflags nohidden

Now drag the file or folder to the end of the command in the Terminal window and then press Return.

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


Sometimes you’ve files or folders on your PC that you want to make sure no one else sees by mistake. And with a simple Terminal command, you can make it happen quickly.

For further queries and questions let us know in the comment section below!

Also Read: Use AirDrop on iPhone, iPad & Mac [to send files]

About the author

Hassan Abbas

Tech enthusiast with too many items on his wish-list and not nearly enough money! Specializing in all things tech, with a slight Apple bent he has been writing for various blogs for the best part of (too many) years

Leave a Comment