In the comments of Customize Prompt On Mac OS X, jh asks how to color your command prompt:
How about the colored bits below the command prompt? I’ve noticed that when I do an ‘ls’ on my own mac it tends to be monochromatic, however, when I’m ssh-d in to a linux machine and ‘ls’ I tend to get output that colors directories, and executables differently. Why is this? And is there any way to get my own mac’s output to be color coded as well?
Of course there is!
Open up ~/.bash_profile and add the following two lines:
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
Save, exit, log out, log in, and there you are!
Update: For tcsh users, I was able to get the same effect putting the following in ~/.tcshrc:
setenv CLICOLOR "1"
setenv LSCOLORS "ExFxCxDxBxegedabagacad"
For iTerm users, add the following to ~/.bash_profile:
export TERM=xterm-color
alias ls='ls -G'
alias ll='ls -hl'

Steve
Mark
I'm running 10.3.8, and made the file as you wrote. I then logged out, logged back in, ran bash (normally use tcsh), did ls and no pretty colours! Any idea what I'm doing wrong? August 3rd, 2005 at 12:45 pm
Brad
Make sure your TERM is set to xtern-color like Steve suggested above.
Also, run the commands from .bash_profile from the command prompt and see if coloring works. It may be a problem with your Mac not running the login script.
- Brad August 3rd, 2005 at 12:53 pm
Mark
Brad
OK, try placing it in ~/.bashrc and see if that works.
Oh, and incase you were wondering about the difference between .bash_profile and .bashrc
~/.bash_profile is executed when you login
~.bashrc is executed when the shell starts August 3rd, 2005 at 1:44 pm
Mark
Darren
Just switched back to good old Terminal and it worked great, colours everywhere! ;) August 3rd, 2005 at 4:18 pm
Mitch
Brad
I was able to get this working with tcsh by putting the following in .tcshrc
setenv CLICOLOR "1"
setenv LSCOLORS "ExFxCxDxBxegedabagacad"
- Brad August 4th, 2005 at 12:27 pm
Brad
I was able to get colors working in iTerm by putting the following in ~/.bash_profile:
export TERM=xterm-color
alias ls='ls -G'
alias ll='ls -hl'
- Brad August 4th, 2005 at 12:33 pm
Ian Sheridan
- Ian August 4th, 2005 at 1:22 pm
Brad
Hasan
Brad
Mitch
Thanks, your suggetion to put
setenv CLICOLOR “1″
setenv LSCOLORS “ExFxCxDxBxegedabagacad”
in .tcshrc worked great.
Mitch August 6th, 2005 at 10:29 am
Trackback
mactips.org
mactips.org is a nice blog with some really interesting tips and hints concerning all OS X topics. It’s now added to NetNewsWire.
Okay, I could have figured it out myself, but with the help of mactips.org, I finally made /bin/ls produce colored …
August 9th, 2005 at 3:54 pmTrackback
Colorize your Mac Terminal
August 10th, 2005 at 2:09 pmTrackback
[...] I was a bit disappointed at the poor support of the Terminal and iTerm for colors on a Mac system. I googled and found an article explaining how to colorize the OSX prompt. [...]
November 13th, 2005 at 4:07 pmKostas
DrS
Trackback
[...] - MacTips - [...]
November 4th, 2007 at 12:35 amTrackback
[...] trick is explained in here, and mostly consists [...]
December 5th, 2007 at 9:58 ampqs
At the end it worked when I added this alias to .bashrc
alias ls='ls --color=always' December 13th, 2007 at 7:05 am
Trackback
[...] was a previous post made on coloring your terminal. It kind of interested me but I didn’t like colors or the [...]
December 22nd, 2007 at 3:05 pmTrackback
[...] was a previous post made on coloring your terminal. It kind of interested me but I didn’t like colors or the [...]
December 22nd, 2007 at 3:07 pmStephen
Always used linux and had to do something similar to get color working with slackware January 17th, 2008 at 8:37 pm
Trackback
[...] ottenere questo risultato è sufficiente seguire una delle tante guide che potete trovare in rete (qui una). L’aspetto interessante sta nel fatto che le modifiche possono essere effettuate (per [...]
March 3rd, 2008 at 12:14 pmAmit Solanki
Pkhunter