I'm trying to set the colour of dirs in Terminal on the latest version of macOS (12.5) with an M1 using fish.
I've tried both the suggested commands: set LSCOLORS XXXX
and set -Ux LSCOLORS XXXX
with XXXX being the desired colour eg G or "dir=1:37".
Both options do change the values in fish_variables (found in the.config/fish dir) but the colours stay the same.
I've looked through the preferences pane for Terminal itself as well as the fish_config but I can't see anything overriding what I'm trying to alter.
What am I missing? Thank you in advance for any help you can offer.
Don't use set -U
when exporting env vars. It's likely to cause problems. Just do set -x
to export an env var. You should be able to confirm it is exported by running env | grep LS_COLORS
env | grep LS_COLORS
. For example, on my system:
> env | grep LS_COLORS
LS_COLORS=di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34:su=0:sg=0:tw=0:ow=0:
If the var is exported and not producing the expected result then the problem has nothing to do with Fish. In particular, note that the macOS ls
command (the /bin/ls one) does not recognize the LS_COLORS
env var. That is a GNU Linux extension. I recommend installing the Homebrew package manager and then brew install coreutils
which will provide gls
command. You can then create a Fish function that invokes gls
when you type ls
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.