Is there a way to automatically make gcc color its output?

I am looking to avoid an alias as the the command is commonly used in makefiles (where it will not be used).

Is there an easy way to do this?

Note: this does require gcc/g++ 4.9, which is currently available via svn. I am willing to recompile if the change is something small (in a config file or something).

I know that the GCC_COLOR environment variable is used, but I am not sure how to set it, or what to set it to.


Add to your .bashrc:

export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

But note that GCC 4.9 is under heavy development, so the defaults may change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.