Search code examples
macosvimterminallocalelocal

Error message when starting vim: "Failed to set locale category LC_NUMERIC to en_CH" (or en_BR, en_RU & LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES)


I freshly installed vim (Vi IMproved 8.1) as a text editor on my MacOS 10.14.5 with Homebrew. Each time that I run vim I get this error message:

Warning: Failed to set locale category LC_NUMERIC to en_CH.
Warning: Failed to set locale category LC_TIME to en_CH.
Warning: Failed to set locale category LC_COLLATE to en_CH.
Warning: Failed to set locale category LC_MONETARY to en_CH.
Warning: Failed to set locale category LC_MESSAGES to en_CH.

I have to click ENTER and it works but I would like to get rid of that error message.

I saw a similar message on that link

How can I get rid of this error message?


Solution

  • First, access your .bash_profile file by typing the following (using vim as text editor):

    vim ~/.bash_profile
    

    Inside the file .bash_profile, insert the following line:

    export LC_ALL=en_US.UTF-8
    

    Note, however, that newer versions of macOS ship with zsh instead of bash as the default shell. If this is the case with your Mac, you will have to edit ~/.zshrc instead of ~/.bash_profile.

    Restart the Terminal or source ~/.zshrc or source ~/.bash_profile and launch vim again: the error message should have disappeared.

    Thanks @geoyws - George Yong and pkropachev Pavel Kropachev for their answer found there, thanks @bk2204 for the hints in the other answer