Home > dircolor, howto, mac osx > Mac OS X Lion terminal color (remote access) problem fix

Mac OS X Lion terminal color (remote access) problem fix

After upgrading to Lion I noticed that the Homebrew theme that I’ve been using since Snow Leopard doesn’t display colors correctly(using different colors for directories, different types of files etc.) any more when working on remote hosts via ssh (local dir colors still work though) and switching to other themes doesn’t help. After messing around with the Terminal settings I finally found the cause and a solution. It seems Lion changed the terminal type to xterm-color256 during the upgrade (don’t remember what the setting was in SL though). The solution is simple enough, just change the emulation type for terminal from xterm-color256 to xterm-color (see screenshot below).

[ Update 1/2/2012 ]
Actually found a better solution here:
1. Keep the current xterm-256color in your Mac Terminal
2. Add the following lines to your ~/.profile on your remote host

[ "$TERM" = "xterm" ] && TERM="xterm-256color"
alias ls='ls --color'

3.

. ~/.profile
About these ads
Categories: dircolor, howto, mac osx
  1. terminal guy
    July 24, 2011 at 8:35 am

    nice, it annoyed me too

  2. GervaisdeM
    July 28, 2011 at 2:23 pm

    Thanks! It was annoying me, but not enough to start poking around to find the answer until today.

  3. Craig Gold
    July 29, 2011 at 6:02 am

    THANK YOU! This worked perfectly!

  4. August 9, 2011 at 3:42 am

    Bless you :-) What didn’t Lion mess with?

  5. Daniel Regalado
    August 11, 2011 at 6:49 am

    Where can i find this at? like the steps..

    • ricoch3n
      August 11, 2011 at 12:10 pm

      Sorry should have put down the details
      1) Launch Terminal
      2) Click Terminal on the top left of the screen
      3) Choose Preferences
      4) Your current theme should be selected by default in the theme list
      5) Click Advanced tab on the top right of the dialog
      6) Under Emulation, choose “xterm-color” as the value for the “Declare terminal as” dropdown
      7) Restart Terminal application, that should be it

      • September 26, 2013 at 3:59 pm

        It worked perfectly. I thought my iPad was bricked. Putting an Hash and space in front of the url for the Apple upgrade center address in private/etc/hosts as per http://support.apple.com/kb/ts4451 was required too. Mountain Lion apparently altered both things without telling anybody, both probably are “Whoops!”.

  6. Valerie
    August 12, 2011 at 5:07 pm

    I followed the awesome steps but my color is still of and some fonts seem unfinished. Any ideas? Eyes getting super squinty ;)

    Thanks!

  7. August 30, 2011 at 11:20 pm

    thanks thanks thanks!

    • ricoch3n
      August 31, 2011 at 12:54 am

      You are very welcome. Glad it helps.

  8. Ulf
    September 22, 2011 at 12:57 pm

    Thanks for this hint :).

    • November 21, 2011 at 3:06 pm

      indeed that did the job. Many thanks

  9. hellios
    September 3, 2012 at 9:11 am

    thanks lot ….

  10. September 17, 2012 at 7:23 pm

    My work machine came with Lion installed, and I haven’t had any issues with the terminal until this morning. Apparently the setting “magically” changed to xterm-color256 all by itself and emacs became unusable.

    Changing the setting back to xterm-color fixed. Thanks for posting this!

    (still not sure how to explain the “magic”, though)

    • September 17, 2012 at 9:10 pm

      You are welcome Abe Skray. The reason why remote ssh (or emacs in your case) stopped working all of sudden is because the terminal type supported by those applications does not support xterm-color256 (think of it as an upgraded version of xterm-color). Changing locale terminal type is just one of the solutions to make the terminal types match each other. You can also try to keep the terminal type settings in Lion as xterm-color256 and declare TERM on the remote host with the method described here:
      http://vim.wikia.com/wiki/256_colors_in_vim

      Good luck.

  11. Ralf
    November 30, 2012 at 9:16 am

    Mountain Lion doesn’t even offer plain “xterm-color” anymore only “xterm-color256″ and “xterm-color16″. But i had success with setting it to “ANSI”. My older Ubuntu Server was then completely cooperative again :)

  12. January 5, 2013 at 5:17 pm

    I’m running Mountain Lion 10.8.2 and there isn’t even “xterm-color” in the list anymore. Just “xterm” seems to work fine.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: