Single Application Mode automatically hides all other open applications when you select an application from your dock.
Double click to launch Terminal from your Applications:Utilities folder.
Input the following command into the Terminal window and press Enter.
defaults write com.apple.dock single-app -bool true
Input the following command to make the change take immediate effect and press Enter.
You will now notice that clicking on an application in the dock will hide all other open applications. Notably, single application mode does not apply to keyboard shortcuts. Thus, you can still use Command+Tab to view multiple applications at the same time.
EXIT SINGLE APPLICATION MODE
To exit Single Application mode, simply input the following commands into the Terminal window.
defaults write com.apple.dock single-app -bool false