Mac OS X: Handy Terminal Dock Tweaks

There are all sorts of hidden goodies you can invoke with Terminal commands, and if you’ve been reading my tips long enough, you know how much I love love LOVE the Terminal, anyway. In this article, I’m gonna cover three commands specifically for changing the default behavior of the Dock. A heads up—it’s always best to copy and paste the Terminal commands you find. If you type things yourself instead and make an error, it’ll either not work, or you could cause your logic board to explode. OK, maybe nothing that drastic could ever possibly happen, but why take chances?

So let’s get started by opening Terminal. It’s within the Applications > Utilities folder.

The first funky thing you can do with your Dock will make the icons for hidden programs appear grayed out. In my screenshot below, Finder, Mail, Chrome, and iTunes are open, but the latter two applications are hidden.

Do this by copying and pasting the following command into Terminal:

defaults write com.apple.Dock showhidden -bool YES

Hit Return, and then paste in the following and hit Return again:

killall Dock

From that point on, you can tell the status of your programs at a glance. If you want to reverse this back to the default Dock behavior, just replace YES with NO in the first command. After each change you make, be sure to put in the killall Dock command to force your changes to take place, or log out and log in again if you like that better.



The second cool Terminal trick is the ability to “pin” your Dock to one corner or another. If you’ve got yours set to show on the bottom of your screen, for example, you can pin it to the middle (which is the default), the right side, or the left side. As you’ll see in my screenshot below, I’ve got mine pinned to the left.

This’ll also work if your Dock is configured to be on the right or left side of your screen. You can pin it to the top, the middle, or the bottom.

Of course, if your Dock is large enough that it takes up the whole edge it’s set to, this isn’t going to show much, so adjust its size in System Preferences > Dock if you really want this to change the look of things.

Here’s the Terminal command:

defaults write com.apple.Dock pinning -string start

Hit Return, and then paste in the following and hit Return again:

killall Dock

Note that the end of the first command is the word start. That’s the syntax you’ll use to pin it to the left of the screen (or the top, if your Dock’s on one side or the other). The other choices are middle and end.

defaults write com.apple.Dock pinning -string middle
defaults write com.apple.Dock pinning -string end

 

The final useful thing to know is how you can make the Dock immutable—that is, unable to be changed. This can be handy if you have a friend or a family member who keeps accidentally removing icons from his Dock. When he can’t find Mail, then, he calls you. Am I getting close? 

I know you want to stop that from happening, so here’s the command:

defaults write com.apple.Dock contents-immutable -bool YES

Hit Return, and then paste in the following and hit Return again:

killall Dock

This’ll even get rid of the Remove from Dock contextual menu option that you can bring up by right- or Control-clicking on an icon, so it’s pretty thorough.

Poof! It’s gone.

 

(As above, to reverse this behavior, just change the YES to NO in the first command and kill the Dock again.)

Maybe that’ll be one less family IT support call you’ll have to take this month. Unless, of course, he then calls you to ask why he can’t take something out of his Dock. Sigh.