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:

  1. Open Terminal.app Preferences
  2. Go to the Settings tab
  3. In your default theme go to the Advanced tab
  4. On the first line Declare terminal as: select xterm-color, instead of the default xterm-256color
  5. Reopen Terminal.app and voilà – the colored SSH command prompt is back!

3 Comments on “Mac OS X Lion and the linux command prompt over SSH”

  1. Sean said at 18:21 on August 2nd, 2011:

    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.

  2. richo said at 12:20 on August 16th, 2011:

    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.

  3. Georgi said at 12:23 on August 16th, 2011:

    @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