How to hide a folder in macOS using the "Terminal"
Macos / / December 25, 2019
For information on how to hide a folder in Windows, you know everything is sufficient to note the appropriate option in the folder properties. Now you'll learn how to hide a folder in MacOS.
Open the "Terminal" and to introduce the following command:
chflags hidden folder name
This command will hide the desired folder in the home directory. If you want to hide a folder located elsewhere, you need to enter the full path to it, for example:
chflags hidden / Users / username / Documents / folder name
To find the path to the folder, click on it, the context menu, and press the Alt key. item will appear in the context menu "Copy path to foldername».
Or just type this command and drag the desired folder in the window "Terminal".
Despite the fact that the folder can be hidden, its content will still be indexed by Spotlight search. To avoid this, it is necessary to exclude from indexing. Go to "System Preferences", click Spotlight, go to the tab "Confidentiality" and enter your folder to the exclusion list.
Now, to access your folder, go in the Finder, select the "Transition» → «Go to Folder". Or press Command + Shift + G on your desktop. Then enter the path to the folder.
To make the folder visible again, use the following command:
chflags nohidden foldername
It's not the most reliable way to hide their files: it can only deceive the inexperienced user. If you need to protect important data, use applications to encrypt files.