How to hide files and folders on macOS

0

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:

  1. 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.
  2. After you launched Terminal, enter the following command line, including a space at the end of it.
    chflags hidden
  3. 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.
  4. 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:

  1. Go to the folder where stores your hidden file or folder.
  2. 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:

  1. Launch the Terminal app.
  2. Type the command line below into the Terminal window, and also remember to type a space after the command:
    chflags nohidden
  3. 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.
  4. 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.