If you need to share your Mac with other people, you may not want them to see the private files and folders. To avoid this situation from happening, macOS offers us a way to hide files and folders.
If you donโt know how to do it, donโt worry! Youโve come to the right place. After reading this article, youโll learn how to hide files and folders on your Mac quickly and easily!
To hide files and folders on macOS
It is recommended that you put all the files youโd like to hide into a folder, then you just need to set the properties of that folder as โhiddenโ.
After you moved all the files you want to hide to a single folder, follow the instructions below to hide that folder:
- On your keyboard, Press the Command key and Space bar at the same time to invoke Spotlight. Then type terminal and select Terminal from the search results.
- After you launched Terminal, enter the following command line, including a space at the end of it.
chflags hidden
- Drag the folder that contains the files you want to hide into the Terminal window and drop it next to the command line.
After you dropped the folder, the path of the folder will appear next to the command line in the Terminal window. - Press Enter on your keyboard to execute the command. The Terminal window will not show the result of that command line. But if you go to the folder where you store the folder you wanted to hide, you will find the folder already “disappeared”.
To access the hidden file or folder on macOS
After you hid the files or folders, you can access them by simply pressing the Command-Shift-. combination.
Here is how to do it:
- Go to the folder where stores your hidden file or folder.
- Press the Command Key, the Shift key and the Period key (the . key) at the same time, then you will see those hidden files and folders.
You can also view hidden files and folders in Finder by executing the following command lines one by one:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
The command lines above tell Finder to show hidden files and then restarts it.
If you want to stop Finder from showing hidden files, run the command lines below one by one:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
The command lines above tell Finder to stop showing hidden files and then restarts it.
To unhide a file or folder
If you want to unhide a file or folder, follow the steps below:
- Launch the Terminal app.
- Type the command line below into the Terminal window, and also remember to type a space after the command:
chflags nohidden
- If the file or folder is hidden, you can open Finder and go to the folder where the hidden file or folder is stored, then press the Command key, the Shift key and the Period key (that’s the . key) at the same time to make them visible. Once you can see the file or folder, drag it to the Terminal window and drop it after the command line, as you did earlier.
- Press the Enter key to run the command.
After you run the command, the file or folder will become visible.
One more thing
It is not a foolproof way to protect your files and folders from others, since other people can easily find those files and folders using the method in this article. To secure your files and folders, you should encrypt them. By encrypting, you prevent others with out encryption password from open them.