How to Hide Files and folders in Mac OS Using The Terminal?

Hello, Friends, I hope that you are the lover of MAC OS. Or you want to know how to hide files and folder in MAC OS. So Definitely, I will tell you about these topics. Because everybody wants to hide own secret files and folder. Now let’s move on topics.

There are a number of methods available to hide files and folders in Mac. But, any random method can’t be taken in to account as it can be extensively time-consuming delaying the output. On this context, given below is a precise method that can be tried to hasten the process.

macos terminal
MacOS Terminal

Also, Check it: How To Hide File/Folder In Windows OS?

A Lengthy Method For Hiding Files In Mac OS

This may be a bit lengthier than the methods given below, but indeed much faster than the random ways talked above. The steps are given below.

  • First go to Open Terminal in Finder, then move to Applications, and then to Utilities.
  • Visit Terminal and then type- defaults write AppleShowAllFiles YES
  • After That Press return
  • Now hold the “Option/alt” key, go to the Finder icon, right click and then click on Relaunch.

mac os

  • You can thus find the whole range of hidden files. To make those hidden again, one may follow the same procedure as of above, except writing-‘ defaults write AppleShowAllFiles NO ’ in place of Terminal command.

Faster method using Terminal Aliases

This is indeed going to be comparatively shorter or less time-consuming methods. Terminal Alias is basically a name or shortcuts used for a single of many commands. With the help of an easier alias, one can replace the above four steps into only one. Interestingly, an alias can be prepared provisionally for the use of a single terminal session; though it can be prepared permanently as well. The best recommendation would be to make it a shortcut that can be used immediately, and also in future.

Given below are the steps:

  • Go to Terminal found in Finder, next to Applications, and then to Utilities.
  • Type sudo nano ~/.bash_profile in the Terminal.
  • Provide the administration password of your Mac if desired, and then return.
  • You can find open.bash profile file at the bottom. You can type or copy-paste “alias showFiles=’defaults write AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/” there.

mac os

  • Now press Control +O and click return to save the file.
  • Press Ctrl + X to come out of the file and go back to the command line.
  • Type or paste, “source ~/.bash_profile to refresh your profile and make the aliases available” in Terminal.
  • In case you wished to make the hidden files apparent, simply type “showFiles” in the Terminal. Similarly, you can type “hideFiles” when you wish to keep it hidden.

In those occasions when you wish to change the alias names, the commands provided are, “alias showFiles=’defaults write AppleShowAllFiles YES;

killall Finder /System/Library/CoreServices/”.

Important Notes:

Here alias notifies Terminal about the addition of a fresh alias. Naturally, “showFiles” is the name of the alias. You can change this the way you like. The commands “defaults write AppleShowAllFiles YES; ” and “killall Finder /System/Library/CoreServices/” are basically to reveal the hidden files and to relaunch the Finder. Note that there is a semicolon used to add another command. In case of the second command, one may simply right click on the Finder icon, which duplicates the step of “Option/alt” key.

As the aliases are set, one simply needs to type “showFiles” and “hideFiles” to showcase and hide respectively, the secret files of your Mac OS X.

I hope, this article will help you to hide file and folder in Mac using the terminal. Because First Time, I was very curious when I did Hid folder on Mac OS. Maybe you will also enjoy for hiding your secrets files in Mac.

Add a Comment

Your email address will not be published. Required fields are marked *