Toggling Hidden Files in macOS Finder

To see hidden files in macOS:

defaults write com.apple.finder AppleShowAllFiles YES

Then re-launch the Finder.

To hide them again:

defaults write com.apple.finder AppleShowAllFiles NO