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)

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


In Short: your macOS/Unix/Linux doesn't have the default configuration of locales and you should connect it when your bash restarted. Therefore the solution is to update config files and reload it (In my example the language would be English and the default encoding would be UTF-8):

If you use oh-my-zsh:

vim ~/.zshrc
export LC_ALL=en_US.UTF-8

If you use fish-shell:

vim ~/.config/fish/config.fish
set -x LC_ALL en_US.UTF-8

else (default):

vim ~/.bash_profile 
#OR (vim  ~/.bashrc) 
export LC_ALL=en_US.UTF-8

if you use zsh, you could

vim ~/.zshrc

and uncomment next line:

export LC_ALL=en_US.UTF-8