HomeRamblings  ⁄  GeneralSystemsServers

Changing ANSI colors in Terminal on Macs

Published: September 09, 2008 (about 11 years ago)
Updated: over 4 years ago

Probably the most frustrating experience I have had with Macs so far is figuring out how to change the ANSI colors in Terminal (Terminal.app) so that I can read the outputs of man and most especially ls and comments in vi when colorization is activated and I have chosen a dark background theme. I am using Mac OS X Leopard 10.5.4 at the time of this writing. These are the steps I took to fix that most hideous of all colors, dark blue on black background:

  1. Set your terminal theme colors to your liking
  2. Set up ls to colorize directory listings by default. There are two ways to do this: Either set the CLICOLOR Environment variable or add an alias for ls to include the -G flag. I chose the CLICOLOR flag:
export CLICOLOR=1
  1. Next up, install the ANSI color SIMBL plugin found here: http://niw.at: works of Yoshimasa Niwa. Make sure Terminal.app is closed while you install the plugin then relaunch Terminal to find under its main menu, “Color Preferences…”
  2. Finally, edit that dark blue away! If you’re interested in tailoring the output of the colors even further, you can also export the LSCOLORS variable:
export LSCOLORS="exfxcxdxbxegedabagacad"

And then change according to the manual entry for ls (“man ls”):

a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background

One final trick to get my bash shell exactly like I like it was to set the prompt. This can likewise be done by editing ~/.profile:

PS1="[\[email protected]\h \W] "
comments powered by Disqus