While the Mac OS X Terminal.app is actually quite nice and feature-rich, I wouldn’t call the default configuration optimal. Let’s see what we can do to make working with the terminal more fun.
Change Terminal appearance
In Terminal settings → Settings, you’re able to choose from quite a few different themes. Pick the one you like best, make it the default (there is a button at the bottom) and make sure you configure the correct theme when making changes. In the Window tab, you can configure transparency and blur (for a translucency effect) by clicking on the background color. Just use the sliders for opacity and blur and experiment with them. Set your window size to something less tiny and maybe increase the font size in the Text tab.
In the Advanced tab, set the terminal emulation to “xterm-color”. Then, edit/create the file “.profile” in your home directory. Add the line export CLICOLOR=1 to add colors to the output of ls. If you’d like a nice colorful bash prompt that contains the path to the current directory in it, add export PS1="\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]\$ ". To add colors to the output of git, run git config --global --add color.ui true.
Fix Terminal keyboard bindings
Page Up, Page Down, Home and End keys do not behave the way they should. Page Up and Page down, by default, scroll the terminal buffer, while Home and End simply don’t work. So let’s go to the Terminal settings → Settings → Keyboard and define some sane mappings.
home: \033OH
end: \033OF
page up: \033[5~
page down: \033[6~
shift+page up: scroll to previous page in buffer
shift+page down: scroll to next page in buffer
You get the character sequence \033 by pressing Escape – manually typing it in won’t work. You can also copy&paste the whole sequence in. Make sure you set the action to “send string to shell” for page up and page down – it should already be the case for home and end.
Furthermore, I like to use the keyboard shortcuts ⌥⌘→ and ⌥⌘← to navigate between tabs for all applications that have tabs. This is already the case for e.g. Google Chrome, Firefox and Adium. For the terminal, this can be changed in System Preferences → Keyboard → Keyboard Shortcuts → Application shortcuts. Just define the new Terminal.app shortcuts for the actions “Select Next Tab” and “Select Previous Tab”.
Fix ssh “broken pipe” errors
While this is technically not a Terminal.app problem, it’s still quite annoying. If your ssh connection is inactive (no data traffic) for a period of time, it might get closed. To remedy this, add ServerAliveInterval 60 to your /etc/ssh_config.
That’s it! Do you have any more tips or hints for Terminal.app to share?