Saturday, October 27, 2012

Mac OS X terminal supports colored output

Mac OS X Mountain Lion Terminal hasn't been configured to support coloured output.
You can check it via simple command run "ls -la":
Let's fix this.

1. Add the next string to  .bash_profile
export CLICOLOR=1

2. Create script:
$ cat ./

echo -e "\033[0mCOLOR_NC (No color)"
echo -e "\033[1;37mCOLOR_WHITE\t\033[0;30mCOLOR_BLACK"
echo -e "\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_LIGHT_BLUE"
echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
echo -e "\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_LIGHT_CYAN"
echo -e "\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_LIGHT_RED"
echo -e "\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_LIGHT_PURPLE"
echo -e "\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_LIGHT_YELLOW"
echo -e "\033[1;30mCOLOR_GRAY\t\033[0;37mCOLOR_LIGHT_GRAY"

$ chmod +x

3. Run ./, you should get something like this:

Also, command "ls -la" should produce colored output. 



  1. Hello there! I could have sworn I've visited this blog before but after looking at a few of the articles I realized it's new to me.
    Anyhow, I'm certainly happy I came across it and I'll be bookmarking it
    and checking back regularly!

    Here is my website: sian

  2. hi...Im student from Informatics engineering nice article,
    thanks for sharing :)