Mac Terminal Tweaks

I spend most of my day in the terminal doing one thing or another. While the default setting work pretty well on the Mac, it’s lacking while connecting to a remote system. Here are some of the tweaks I’ve made to make the terminal app more useful for me.

Not all systems know how to handle a terminal type of xterm-color. I did find a terminal definition for xterm-color and successfully applied it to AIX, but I’d rather not do that to all my systems. So, you can change the terminal type to xterm by default. Under Terminal Preferences -> Settings -> Advanced, change the “Declare terminal as” to xterm. You can also select dtterm (not as well supported on AIX, and not color) or several flavors of vtterm.

For some reason, Apple thinks the page-up and page-down keys should scroll the buffer back. I’d rather actually use page-up and page-down in my terminal than just using it to scroll back. You can adjust the key codes under Terminal Preferences -> Settings -> Keyboard. Then, edit the keys and set them as:

page down: \033[6~
page up: \033[5~

You can also try:
Home: \001 or \033[7~
End: \005 or \033[4~

It also bugs me that the terminal doesn’t exit when I logout. I then end up going to the mouse and closing the window or hitting Command-W. You can make the terminal close, only if the program it’s running exits with a 0 return code. Go to Terminal Preferences -> Settings -> Shell, and change “When the shell exits” to “Close if the shell exited cleanly”.

I’d like it if the terminal name changed to the system I’m connected to, but I haven’t found how to do that yet. I have made the terminal window bar a little more useful. Under Terminal Preferences -> Settings -> Window, I have “Active process name”, “Dimensions”, and “Command key” checked. That gives me a window bar something like: Terminal – ssh – 80×24 – CMD4

I don’t care for the block cursor either. It tends to hide the character under the cursor in vi. So, I changed the cursor to a pipe. Under Terminal Preferences -> Settings -> Text, change the Cursor radio button to “| vertical bar”. You can also change it to an underscore.

While you’re in here, check out the different window themes. I’m using Homebrew now. It’s a nice green on black theme with just a little transparency. You can change your default new terminal session theme under Terminal Preferences -> Startup if you find one you like better.

Leave a Reply

Your email address will not be published.