Abbey Workshop

OS X: Terminal Settings for X11

If you use the OS X X11 application to run applications on another Unix machine, you may have noticed that the default terminal is so tiny you can hardly read it. This drove me nuts at first as it is easier to control the application with the xterm apps within X11 than to use the Terminal application. In addition, there were no scroll bars on the window which can be a pain when you are using your laptop without an external mouse. Well after much searching and trial and error, I have found some useful information that gets everything setup nicely.

XTerm Command Line Options

In this section I will review just a few of useful command line options for xterm. One of the interesting things I found was that some of the options only work in concert with another option. So for example, if you try to set the font size (-fs) without setting the font face (-fa) nothing happens and your terminal window still has a tiny font.

Font Size

As mentioned above, to set the font size, you must also set the font face. For example, to set the font size to 14 and the face to Monaco, you would do the following:

xterm -fa Monaco -fs 14 &

Scroll Bars

The scroll bars on the xterm are pretty primitive, but they can be nice to have when you don't have a wheel mouse with you. To turn them on add the following command line parameters.

xterm -fa Monaco -fs 14 -sb -sl 1000 &

The -sb option turns on the scroll bar and the -sl 1000 option sets the number of lines in the scroll buffer to 1000.

Color

You can also change the foreground and background colors for the terminal. I prefer white on black, but you can set the colors to what you want with the following options.

xterm -fa Monaco -fs 14 -fg white -bg black &

The -fg option sets the foreground color. The -bg option sets the background color.

This command will work from an X11 xterm window. What if you want to set the values as defaults or have different options in the applications menu. That is covered in the next section.

Adding a New xterm to the Applications Menu

To add a new xterm option to X11, from the application menu choose Application -> Customize. Choose add item to create a blank entry in the application list. Just fill out the information and options you would like to include. The following picture shows some examples:

X11 Application Customize Dialog

Note that you can create a shortcut for the entry by adding a letter in the shortcut field.

Changing the Default xterm

The only think missing is the default behavior. When you load X11, it still loads a tiny xterm. By default, OS X loads the .xinitrc file in the user's home directory. However, you probably don't have one of these files. If you do not, the file is loaded from /private/etc/X11/xinit/xinitrc. If you take a look at this file, it sets a number of things up, and then launches an xterm. I used this file as my basis for my .xinitrc file. Just copy the file to your home directory and rename it (be sure to precede the name with a period, .xinitrc). Then change the line that launches the xterm to the values you want. No more eye strain!