To enable this switching mode, open Terminal and type these commands:
$ defaults write com.apple.dock single-app -bool TRUE
$ killall DockFrom now on, clicking on an application in the Dock will hide all other open apps while switching to the selected application. You will not see this behavior if you use Command-Tab to switch, or click directly on another application’s windows.