Colored Terminal with zsh

for the last versions of macOS

Posted by Daniel Vela on May 26, 2022
Read this page in a different language:

Last macOS versions have zsh by default, instead bash. Better than try to use bash again, is to use a new way to add color to Terminal for zsh.

Create a file called .zshrc in your $HOME path, with the following content (then restart terminal):

LS_COLORS='no=00;37:fi=00:di=00;33:ln=04;36:pi=40;33:so=01;35:bd=40;33;01:'
export LS_COLORS
export CLICOLOR=1
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
PROMPT='%F{green}%n@%m%k %B%F{cyan}%(4~|...|)%3~%F{white} %# %b%f%k'

Additional Doc