Mac OS X Lion Terminal.app not showing ANSI colors on Linux – here’s a fix

Connecting to Linux node from Mac’s Terminal.app and not seeing ANSI colors? Here’s a fix:

On your target Linux node check your /etc/DIR_COLORS file (or equivalent):

root:[/root]# grep TERM /etc/DIR_COLORS
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM cons25
TERM xterm
TERM rxvt
TERM xterm-color
TERM color-xterm
TERM vt100
TERM dtterm
TERM color_xterm
TERM ansi
TERM screen
TERM screen.linux
TERM kon
TERM kterm
TERM gnome
TERM konsole
root:[/root]# 

Make sure the “TERM” definition in this file matches your Terminal.app Preferences-> Advanced -> Emulation Options:

MAC OS X Lion: Terminal.app Emulation Options to enable color in Linux bash

By default the Terminal Emulation was set to “term-256color” and that option is not recognized in /etc/DIR_COLORS.

And if you want ANSI colors for ls -l to work in your MAC terminal on your local MAC machine add the following to your $HOME/.bash_profile:

alias ls='ls -G'

REFERENCE:

Where is ‘ls = ls –color=tty’ alias defined on Linux
IR_Black for OS X Lion

February 3, 2012

Posted In: Linux, Mac

Tags: , ,