How to Hide Files and Folders on Your Mac | Tips & Tricks
If you want to make some files or folders disappear from sight, there are several methods you can use to hide files and folders on your Mac. This won’t encrypt the files, but it will make them invisible while browsing in Finder.
Hide the File with System Commands
macOS offers a couple ways that allow experienced users to employ system functionality to hide files. They all involve Terminal in varying capacities. There are also apps that will execute these commands behind a graphical interface if you’re not confident with the command line.
Set the Hidden Flag in Terminal
1. Open Terminal.
2. Type in the following commands, but don’t press the “Enter” key just yet:
3. Drag the file or folder you want to hide into the Terminal window.
4. Once the path appears in the Terminal window, press “Enter” to set the hidden
flag.
Remove the hidden flag with the same process, but change the command to chflags nohidden
instead.
Hide with a Period
Files or folder names that start with a period (“.”) are automatically hidden in Finder. You can use Terminal to add a period to the beginning of any file or folder’s name, hiding the file from casual view.
1. Open Terminal.
2. Navigate to the folder containing the file you want to hide in Terminal using the cd
command.
3. Use the mv
command to “move” the file you want to hide from its current name to one starting with a period, like so:
It doesn’t look like much, but this will immediately hide the file.
To reverse this process, just invert the command, like so:
Set the Visibility Attribute to Invisible
If you have Xcode or Apple Developer Tools installed, you can also use the visibility attribute.
1. Open Terminal.
2. Type the following command but don’t press “Enter” yet:
3. Drag the file or folder into the Terminal window.
4. Press “Enter” to execute the command and hide the file.
To undo the command, change the uppercase V
to a lowercase v
like so:
Revealing Hidden Files in Finder
Locking a door isn’t much good if you cannot also unlock it. There are two main ways to do it, and both will reveal all hidden files, regardless of the method used to hide them.
Both have exactly the same effect, and the second one is typically easier to remember and execute on the fly.
Of course, advanced users will know you can always see hidden files and folders in Terminal with ls -l
. You can also employ Finder’s “Go to Folder” command to navigate directly into a hidden folder, provided you know the exact path.
With Terminal
1. Run the command below in Terminal to reveal all hidden files.
defaults write com.apple.finder AppleShowAllFiles TRUE ;killall Finder
Finder will restart after you run this command, so make sure you’re not in the middle of emptying the trash or copying files.
When you’re done, re-hide the files by changing the TRUE
in the previous command to FALSE
, like so:
defaults write com.apple.finder AppleShowAllFiles FALSE ;killall Finder
With Finder
1. Open a Finder window and press Command + Shift + Period. This will reveal all hidden files.
2. Hide files again by pressing the same key command: Command + Shift + Period.
Hiding in System Folders
You can also hide files by putting them in system folders. This is the kind of trick you might use to hide adult materials from a snooping parent, but it is effective nonetheless.
By default, the Library folder is hidden on macOS. This makes it a useful place to stow files, and they’ll be easily accessible.
1. Click on the “Go” menu in Finder.
2. Hold down the “Option” key to reveal the “Library” menu option.
3. Click on “Library” to navigate to the folder.
4. Create a new folder within the Library folder and name it whatever you’d like.
5. Place your sensitive files inside that directory.
For extra security, you can layer your hidden directory inside multiple cryptically-named folders. Be careful about hiding it inside folders actively used by applications, however. Dropping random files in to “Library/Application Support” might have unexpected consequences.
Conclusion
These techniques will only hide files from the most novice of computer users. If you’re sick of a friend or family member casually digging around in your stuff, this kind of protection is probably sufficient. But be aware that these techniques offer you zero protection against a serious attempt by a trained professional or even knowledgeable amateur. Don’t forget that you can also encrypt files individually or encrypt your entire disk image.