Search code examples
macosshellterminalcolors

OS X Terminal Colors


I just got a Mac after working with Ubuntu Linux for some time. Among the many things I'm trying to figure out is the absence of colors in my terminal window- like the ones that are shown (on Linux) when running ls -la or git status.

How can one activate colors in their shell?


Solution

  • Here is a solution I've found to enable the global terminal colors.

    Edit your .bash_profile (since OS X 10.8) — or (for 10.7 and earlier): .profile or .bashrc or /etc/profile (depending on availability) — in your home directory and add following code:

    export CLICOLOR=1
    export LSCOLORS=GxFxCxDxBxegedabagaced
    

    CLICOLOR=1 simply enables coloring of your terminal.

    LSCOLORS=... specifies how to color specific items.

    After editing .bash_profile, start a Terminal and force the changes to take place by executing:

    source ~/.bash_profile

    Then go to Terminal > Preferences, click on the Profiles tab and then the Text subtab and check Display ANSI Colors.

    Verified on Sierra (May 2017).