When I upgraded to Lion suddenly my colorful SSH prompts on remote linux machines became dull and black and white. It took me some time to figure out what was going out, so at first I edited my Ubuntu .bashrc file and uncommented force_color_prompt=yes
. But this didn’t seem right. So after some digging I found the problem – in Snow Leopard Terminal.app by default was identifying itself as xterm-color, but now in Lion it is xterm-256color, which the remote Ubuntu did not recognize. So to fix it without changing anything on the remote machines, do the following:
- Open Terminal.app Preferences
- Go to the Settings tab
- In your default theme go to the Advanced tab
- On the first line Declare terminal as: select xterm-color, instead of the default xterm-256color
- Reopen Terminal.app and voilà – the colored SSH command prompt is back!
Thanks. Silly little thing to not realize, but your post fixed things up nicely. Had the same issue when SSHing to my 10.6.7 box.
On the whole either will work with correct terminfo on the remote end. For a long time I had kludges in my .profile to deliver a similar effect but after putting it off for a while I just fixed the terminfo on the remote machines, the new TERM setting is much more reflective of the terminal in question.
To fix the terminfo (I use the word fix pretty loosely here) on linux machines just create a symlink from /lib/terminfo/x/xterm-color to /lib/terminfo/x/xterm-256color (ie, ln -s /lib/terminfo/x/xterm-color /lib/terminfo/x/xterm-256color )
I’m not sure where OSX keeps it’s terminfo, but the process would be the same. HTH.
@richo: thanks for the tip. The post, however, is not about logging into Mac OS X machines, but rather from a Mac OS X into linux machines. Some of these I can quickfix the way you suggest but to some other I do not have the required permissions, so fixing my terminal’s identification is much easier than symlinking files several machines