How to show/hide hidden files in Mac

  • Add the following snippet to ~/.bash_profile
alias show_files="defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app"
alias hide_files="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app"
  • Reload the changes
source ~/.bash_profile
  • To show the hidden file
show_files
  • To hide files
hode_files