10.7: Disable alternate screen use in xterm terminals

Sep 12, '11 07:30:00AM

Contributed by: mingo

In Lion the xterm terminal settings have been updated and now emacs, vi, less, pine, and more, among others use the 'alternate screen' feature in which the screen is cleared after the process quits. Here is a way to restore the previous behaviour, in which the final screen remains in the scrollback.

I found this in a post by Chris Johnsen, who explains how it works.

For example let us suppose that you are using the default terminal: xterm-256color. (See Terminal.app>>Preferences>>Settings>>Advanced.) At the command line type:

infocmp | sed -e 's/[sr]mcup=[^,]*,//' > /tmp/noaltscreen-terminfo

Press Return and then type:

tic -o ~/.terminfo/ /tmp/noaltscreen-terminfo

This creates a file ~/.terminfo/78/xterm-256color in your home directory. When you open a new Terminal.app window the local file is used, while other users get the default Lion behavior.

[crarko adds: I haven't tested this one. In the referenced post above it is also suggested that the command man something | more will accomplish the same effect just for man pages without changing the overall behavior of the terminal.]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20110905185128781