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
nice, it annoyed me too
Thanks! It was annoying me, but not enough to start poking around to find the answer until today.
THANK YOU! This worked perfectly!
Bless you :-) What didn’t Lion mess with?
Where can i find this at? like the steps..
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
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!”.
I followed the awesome steps but my color is still of and some fonts seem unfinished. Any ideas? Eyes getting super squinty ;)
Thanks!
Not sure if you enable dir color support in your current terminal settings if not pls follow http://stackoverflow.com/questions/973899/how-to-configure-mac-terminal-to-have-color-ls-output (first answer) to check/setup.Note this only affects your local ls command output, to have DIR color support in a remote system you will also need to enable it there, you might want to check out http://stackoverflow.com/questions/2613662/display-directories-with-a-bold-font-how-to-enable-with-bash-profile as well. As for the font problem I am sorry I don’t have an answer for it.
thanks thanks thanks!
You are very welcome. Glad it helps.
Thanks for this hint :).
indeed that did the job. Many thanks
thanks lot ….
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)
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.
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 :)
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.