Developments in Digital
Developments in Digital

Setting colors on Mac terminal

If you're missing colors within your Mac terminal, you can edit your ~/.bash_profile (personal settings) file:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced

alias ls='ls -GFh'

You can also set the style and color of the prompt and continuation with:

function prompt {
  local RED="\[\033[0;31m\]"
  local GREEN="\[\033[0;32m\]"
  local BLUE="\[\033[0;34m\]"
  local PURPLE="\[\033[0;35m\]"
  local RESETCOLOR="\[\e[00m\]"

  export PS1="\n$RED\u $PURPLE@ $GREEN\w\n $BLUE[\#] → $RESETCOLOR"
  export PS2="| → $RESETCOLOR"
}

prompt

Note this is assuming that your terminal is running bash. You can test this by typing echo $0 in the terminal, the result should be -bash.

To configure Git colors edit your ~/.gitconfig file:

[color]
    branch = auto
    diff = auto
    status = auto
[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
[color "status"]
    added = yellow
    changed = green
    untracked = cyan