How to reveal hidden files in macOS Finder

There are many hidden files and folders in macOS. Hidden files are used by the operating system and applications for their inner working. These files by default are not shown in Finder to keep things simple and to prevent casual users from messing with them. 

However it is occasionally useful to access hidden files especially for troubleshooting purpose. To reveal hidden files in Finder, open the Terminal app and enter the following commands:

$ defaults write AppleShowAllFiles YES
$ killall Finder

The first command set the Finder default attribute AppleShowAllFiles to boolean YES in order to show files. The second command relaunch the Finder.

If you take a look at your desktop or Finder now, you can see that there are some new files that were previously hidden. A word of caution, hidden files are hidden for a reason. You can do serious damage to macOS if you don’t know what you’re doing making changes to hidden files.

To hide these system files in Finder again, repeat the same commands by changing the Finder default attribute AppleShowAllFiles to boolean NO, like so:

$ defaults write AppleShowAllFiles NO
$ killall Finder