41

I have a strange issue - when I use the git command which comes with the Command Line Tools package, the interface on the command-line is in English, as I want it to be. However, the version installed using Homebrew uses German in its output (I live in Germany, but my system language is set to US English and the computer was actually bought in Singapore, if it matters).

I believe this changed only recently. I had to give my Mac for repair and did so in a German store. Now that I have my computer back I noticed that Git's output is in German, not sure if they did anything to the system settings while they had it. As far as I know, this is the only command-line application that uses German as its language. Here is the output generated by the locale command:

LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

I would like to have Git talk to me in English. I know I can set the LANG etc. to English and it would (probably) work, but I would also like to understand where this change may be coming from.

Any ideas?

EDIT: to make things more interesting, I use another Mac that I got from work. It was bought in Germany, the initial language settings were German (which I changed to US English) and everything works fine on it, i.e. both Git installations (CLT and Homebrew) use English. Locale information from the locale command is the same.

  • I think I am having the same issue. Running on macOS Mojave 10.14 (18A389), Homebrew 1.7.6, git version 2.19.0 … – Frank Lämmer Sep 28 '18 at 9:56
  • 2
    This just happened to me when I upgraded to Mojave; until now it worked fine. All OS X interfaces in English, C locale, but I'm in a German-speaking country and git is talking to me in German. So how does git decide what language to use? – alexis Nov 22 '18 at 8:26
54

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).

  • 1
    I'm not yet on Mojave, but this fixed my issue. And as you say, VSCode or Idea terminal was in English, just iterm2 was in German. I do have quite a few input sources, including German, as I often write in different languages and need their special characters. It seems (just tested) when I add an input source it also adds a language to 'Language & Region' list, which is not really necessary and causes the issue. Strange enough, English was still on top of that list but somehow overridden by the second language, German. Hmm. – wujek Sep 29 '18 at 22:09
  • 1
    A similar thing happened to me after updating to Mojave. My Terminal git was in English but the git through the IntelliJ terminal was in Spanish (my secondary language in Language & Reigon). I explicitly set my LANG environment variable and that fixed it, because I want Spanish in Language & Reigon – Sam Sep 29 '18 at 22:13
  • @wujek the fact that you’re not using Mojave, allows for possibility that it is still might be an issue with the most recent git package on homebrew. On my system, only two changes have been made after which I’ve noticed the issue: update to Mojave and upgrade of the git package with homebrew. – Anton K Sep 30 '18 at 6:02
  • 1
    I was so surprised to see git in Russian :D – Artem Nov 8 '18 at 17:10
  • 2
    Deleting a language is not a solution. I set LANG=en_US.UTF-8 and it's still in French. – Walker Rowe Jan 10 at 16:13
8

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 :)

  • actually en_EN is not a valid locale. Valid locales have country codes as the last 2 characters, so, e.g., en_US and en_UK are valid locales. – Walter Tross Mar 29 at 14:30
4

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

2

From what I can tell, it's a problem with GNU gettext rather than a problem with Git.

It looks like the bug was fixed in GNU gettext v0.20; but, as of this posting, Homebrew unfortunately provides only v0.19.8.1.


I reproduced the problem as follows:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.4
BuildVersion:   18E226
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
$ defaults read -g AppleLanguages
(
    "en-JP",
    "ja-JP",
    "sv-JP"
)
$ brew info gettext
gettext: stable 0.19.8.1 (bottled) [keg-only]
GNU internationalization (i18n) and localization (l10n) library
https://www.gnu.org/software/gettext/
/usr/local/Cellar/gettext/0.19.8.1 (1,934 files, 17.0MB)
  Poured from bottle on 2016-06-24 at 02:05:52
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gettext.rb
...
$ /usr/local/Cellar/gettext/0.19.8.1/bin/msgcat --version
msgcat (GNU gettext-tools) 0.19.8.1
Copyright (c) 2001-2016 Free Software Foundation, Inc.
Licens GPLv3+: GNU GPL version 3 eller senare <http://gnu.org/licenses/gpl.html>
Detta program "ar fri programvara.  Du kan modifiera och distribuera den.
Det finns inte NAGON SOM HELST GARANTI, till den grad som lagen tillater.
Skrivet av Bruno Haible.
$ sudo filebyproc.d
CPU     ID                    FUNCTION:NAME
...
  2    957              open_nocancel:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/bin
  2    957              open_nocancel:entry msgcat /etc/localtime
  2    957              open_nocancel:entry msgcat /var/db/timezone/zoneinfo/posixrules
  2    957              open_nocancel:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/locale.alias
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/en_JP/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/en/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja_JP.eucJP/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja_JP.eucjp/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja_JP/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja.eucJP/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja.eucjp/LC_MESSAGES/gettext-tools.mo
  2    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/ja/LC_MESSAGES/gettext-tools.mo
  3    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/sv_JP/LC_MESSAGES/gettext-tools.mo
  3    171                       open:entry msgcat /usr/local/Cellar/gettext/0.19.8.1/share/locale/sv/LC_MESSAGES/gettext-tools.mo
0

I had the same issue with Mojave and Git 2.19, but I just updated the Git to 2.21 and it worked as expected again.

  • 1
    I'm having the problem with git 2.21.0 – Walter Tross Mar 29 at 14:21

You must log in to answer this question.

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