1

If I do ls -G, I do get the colors. From what I understood from the man pages, if I go into ~/.bash_profile and add export CLICOLOR=1 I would then get colors by doing just ls, as "This option is equivalent to defining CLICOLOR in the environment."

Am I understanding this wrong? Because it's not working for me on Yosemite 10.10.5 in bash with homebrew coreutils(not sure how much of that is relevant). I tried adding this in ~./bashrc but same thing. I could always just alias my ls to ls -G, but I want to do this the "right" way. I also tried adding export LSCOLORS=... but it didn't help either. Like I said I do get colors with -G, but I'd like to get them by default by just typing ls and not having to set an alias for it, unless my understanding of how this works is wrong.

  • 1
    If you set the variable manually in your active shell, does ls have colors? It's possible your bash_profile is either not being sourced, or being overwritten for some reason – Vitalydotn Nov 23 '15 at 3:47
  • What happens if you run CLICOLOR=1 \ls ~ (the `` is intentional)? – nohillside Nov 23 '15 at 7:26
  • See apple.stackexchange.com/questions/125060/… as well – nohillside Nov 23 '15 at 7:26
  • You likely didn't source the file. Run . ~/.bash_profile – JBallin Apr 9 '18 at 23:12
1

A few issues.

Homebrew coreutils ls is not the OSX/freebsd ls. Coreutils is GNU, and that ls uses --colors instead of -G. -G in gnu ls means do not show groups. It does not use CLICOLOR either. There is no environmental variable to set colors for gnu ls.

OSX's ls uses -G as a command line option, in the same way that exporting CLICOLOR would as an environmental variable.

So you are using the wrong variable for the wrong command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .