While macOS always seems complete to me in more ways than one, there are a few shortcomings that disappoint me at times. If the unavailability of simple dark/light mode and Turbo Boost toggles seem hard to explain, the lack of a straightforward way to conceal confidential files has never failed to baffle me. In an age where an extra layer of shield against prying eyes has become the need of the hour, there has to be a quick way to keep sensitive files under the wraps, hasn’t it? So, what’s the workaround? Turns out, there is a viable trick to hide or unhide files and folders with Terminal on Mac. If you feel comfortable using Terminal commands, you may find this hack quite helpful. Let’s unravel it!

Clearing out a few doubts right at the beginning is always better, especially when you are dealing with a hack like this one.

Nope. So, long as you have easy access to the Terminal commands (or remember them), you can quickly keep any files out of sight on your Mac. If you ever want to revert and make those files show up again or view the hidden files, you will have to go through the same route – albeit with different commands (direct path can also work for viewing). As these commands work pretty well and that too without any complexities, you can master them without any hassle. And yes, you also don’t need to be running the latest iteration of macOS to use this hack.

chflags hidden

View Hidden Files and Folders on macOS

Wondering where has the file gone and how you can access it? Well, it’s just as straightforward.

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

  1. Hit the Return key.  Now, you can view all of your hidden files in Finder.

If you wish to unhide the specific files you had concealed earlier, you can do so with ease.

chflags nohidden

  1. Next, make sure to include a space at the end of the command. Then, drag the file to the end of the command and then press the Return key. 

Check out, your file has once again begun to show up in the Finder. That’s pretty much it!