I am using either Windows 7 or Ubuntu 12.04 and trying to SSH into OSX 10.6.

Using Vim color schemes, I can emulate the colors on xterm-256 color on Linux and gVim on Windows. However, I would like the colors to follow through when I am SSHing onto the OSX. The default terminal, however, does not support xterm-256color.

Is there a way to have OSX use iterm2 by default, to accept all SSH requests instead of terminal.app? If not, is there a way to install xterm-256color into the default terminal?

Upgrading to Lion is out of the question at this point. Thank you!


Once you logged into the OS X system with a terminal emulator that does support xterm 256 color (among others putty or ZOC terminal support that under Windows). After login, type echo $TERM and if it outputs xterm-256color you should be good so far (i.e. the terminal tells OS/X that it wants to be served xterm-256 codes).

Then check if 10.6 does have a termcap/infocmp file for xterm256 by typing infocmp xterm-256color (I think 10.6 has that but I'm not sure ... if you get some crypitic output from the command, it is supported).

From that point on, it is up to VIM, if it wants uses these colors or not. You may have to configure it with a 256-color palette or use a mac port of a new version of vim.

  • Unfortunately the default terminal in leopard does not support 256 colors, so I wanted to either force it somehow to use it or use a third party terminal by default to accept SSH requests. Is this possible? – user1104160 Oct 2 '12 at 16:09
  • If you are SSHing from Windows or Linux into OS/X, the OS/X terminal isn't relevant. If the above (in my answer) infocmp xterm-256color command yields output, the OS/X system has the necessary tables to supply an application (like VIM) with the codes to serve an xterm-256color terminal. In that case the question is if your Windows/Linux terminal makes the connection with xterm-256 (that's what echo $TERM will tell you after logging into the Mac with SSH). And if it does, the next question is if VIM on MacOS is configured/supports 256colors (my guess is that VIM is the weak point). – QSQ Oct 2 '12 at 17:17
  • Really? Interesting, as I am using 256 xterm in Purty and the Linux terminal. Also, Vim is configured to use 256 colors. So you are saying that even if the osx terminal does not support the colors I can still receive them? – user1104160 Oct 2 '12 at 18:04
  • 1
    Yes. If you SSH from outside into the Mac, terminal.app is not part of the equation. (Terminal.app is technically a terminal client like putty and Xterm, it just does connect to the system without going through the sshd server.) – QSQ Oct 2 '12 at 18:18
  • Thank you, the problem was actually trivial. I did not know what you said and assumed that the terminal sent what it was compatible with, so I set the bash environment to use xterm-color (as I thought this was an improvement over xterm and xterm-color256 was not working). As a result, this broke the Linux and Putty terminals. Removing that setting made everything work. This is one of those ironic cases where I thought I was solving a problem that did not exist, therefore CREATING the problem I was trying to solve. Thank you! – user1104160 Oct 3 '12 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.