Force Dock to hide programs on switch

As you may know, you can force OS X to hide all open windows by holding down Command and Option before clicking on a program in the Dock. With these keys held down, the clicked-upon program will come to the foreground, and all your other programs (and their windows) will be hidden. Hiding while switching can be very useful for those times you want to focus on the program you’re switching to.

But what if you’d like to always use this mode, without the need to hold down the Command and Option keys? With a little help from Terminal, you can easily make the Dock do just that. Open Terminal (in Applications -> Utilities), and enter these two commands (don’t type the $ symbol; those are just new line symbols):

$ defaults write single-app -bool TRUE
$ killall Dock

When the Dock restarts, any time you click a program’s icon in the Dock, all other open programs will hide. Note that this behavior is all-or-nothing; you can’t selectively decide which apps hide and which apps don’t hide. It will, however, only work if you click the Dock; clicking a program’s window in the Finder, or using Command-Tab, will not invoke the “hide all” behavior. If you decide that this always-hiding approach isn’t ideal, you can reverse it with these commands:

$ defaults delete single-app
$ killall Dock

As an alternative solution to the “I need to focus on this app” problem, you might try Freeverse’s free Think. While not an exact replacement for “hide others on switch,” it has some nice features that make it easier to focus on one program at a time.

Shop Tech Products at Amazon