When you use the macOS finder to browse files, you can not see the hidden files by default. But sometimes you need to show those hidden files in the macOS Finder to operate on them such as copy, move, etc. This article will tell you two methods to show hidden files in the macOS Finder.
1. Press Command + Shift +. Key.
- Open the macOS Finder and go to your desired folder.
- Then press the Command + Shift + . key on the keyboard.
- It will show the hidden files in the macOS Finder. Press the key combination Command + Shift + . again, it will hide all those hidden files.
2. Enable Show Hidden Files Permanently By Script Alias.
- If you want to display hidden files every time when you open a macOS Finder, you can write the below script alias in the MacOS user’s .bash_profile file, and then run the alias.
- After the alias execution when you open a Finder, it will display the hidden files as you want.
- Open a terminal and run
cd ~
to go to the mac user home directory. - Execute
sudo vim .bash_profile
in terminal to edit the .bash_profile file. - Press i to insert text in the .bash_profile file. Input below script at the end of the .bash_profile file.
# Define show hidden files alias to show hidden files. alias showHiddenFiles='defaults write com.apple.finder AppleShowAllFiles YES; # Relaunch MacOS Finder. killall Finder /System/Library/CoreServices/Finder.app' # Define hide hidden files alias to hide hidden files. alias hideHiddenFiles='defaults write com.apple.finder AppleShowAllFiles NO; # Relaunch MacOS Finder. killall Finder /System/Library/CoreServices/Finder.app'
- Press esc :wq! to save the above file.
- Run
source .bash_profile
to make the changes take effect. - Run the showHiddenFiles alias in a terminal, then it will restart opened finder and display hidden files.
- Run the hideHiddenFiles alias in a terminal, then it will restart opened finder and hide hidden files.
Bash didn’t like the newlines between the single quotes in the text box above. I made each alias one line and that seems to work.
# set aliases to show or hide hidden files in macOS
alias showHiddenFiles=’defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app’
alias hideHiddenFiles=’defaults write com.apple.finder AppleShowAllFiles NO; kill Finder /System/Library/CoreServices/Finder.app’