Apple - Homebrew and Git - Wrong language on the command line

Recently, I've started to observe the same behavior, particularly with git (and after updating to MacOS Mojave). At first, I thought it's an issue with git itself. So, I've reinstalled git with homebrew to no avail.

However, going to "Language & Region" tab in the MacOS "Settings", and removing other languages from the list that you don't need (note: these are different from the keyboard input sources) resulted in git displaying the command output messages in terminal in the desired language (in my case, English).

Notably, this problem occurred to me only in the macOS terminal (and not, e.g., VSCode's terminal).


I'm having the same issue. After homebrew upgrade git 2.17.0 -> 2.19.1, I find that the new git version starts to respect LANG env variable.

If

LANG="en_US.UTF-8"

or

LANG=

git will use English.

If, e.g.,

LANG="zh_CN.UTF-8"

git use Chinese.

I haven't read the commit logs of git, but I think it's working as intended. Just feel a little odd to see non-English git command line output messages :)


Add this to your .bash_profile file-- there's a similar bug with PyCharm's terminal component on macOS mojave (10.14).

# locale settings, string mac/chinese/pycharm/git bug
# https://coderwall.com/p/ehvc8w/set-lang-variable-in-osx-terminal-app
export LANG="en_GB.UTF-8"
export LC_COLLATE="en_GB.UTF-8"
export LC_CTYPE="en_GB.UTF-8"
export LC_MESSAGES="en_GB.UTF-8"
export LC_MONETARY="en_GB.UTF-8"
export LC_NUMERIC="en_GB.UTF-8"
export LC_TIME="en_GB.UTF-8"
export LC_ALL=

After doing this, you'll need to restart your system for it to take effect.

Credit goes to this blog post