First when I started using Mac, hiding files and folders on Mac looked like a huge task for me. But one day it strike that Mac is a Linux flavor so I used to hide files and folders on Mac using the terminal. Once you fire a command a command on the terminal, the file gets disappeared. That is how it works.
There are actually three methods which would let you hide files and folders on Mac using terminal. And the best part is that there is only way to unhide the files irrespective to the way they were hidden.
Method 1 – Hide Files And Folders On Mac
On Linux, if name of a file or folder starts with “.”, then automatically gets hidden. So, if you are creating a new file or folder that you want to hide, just add a “.” at the start of its name. And if you want to hide an existing file or folder, then you need to rename it with a “.”. Below is the command that you need to fire:
cd location where the file or folder exists
mv -i File.txt .File.txt
This command will hide the file and its new name would be .File.txt
METHOD 2 – Hide Files And Folders On Mac
Now, there is another way to hide files. Enter the below commands on the terminal:
cd location where the file or folder exists
setfile -a v name of the file
This command will automatically hide the file. You can unhide it the conventional way that we would be discussing later or your fire the same command that was fired above to unhide it.
METHOD 3 – Hide Files And Folders On Mac
In this method, you can use concept of changing flags of Unix in order to hide the file. You can fire the below command to hide a file on Mac:
chflags hidden ~/path of the file
And if you want to unhide the same file or folder you can fire the similar command. Once you fire the below command, it would unhide it:
chflags unhidden ~/path of the file
Access Hidden Files And Folders On Mac
Once you hide files following any of the above method, you can use the following method if you want to access those hidden files and folders. All you need to do is open the Finder utility and then use the Go To Folder option. This can be done by using the keys, Command + Shift + G.
Once it launches and prompts you to enter the complete path of the hidden file, and then you get to access it the normal way. This is you can hide files and folders on Mac and then access them.