Pilgrimbreak


The true story of a life long pilgrimage


How to avoid Perl warning: Setting locale failed on Mac OSX.

It took me a long time before I decided to handle an issue when connecting via ssh to a server. I had the following error everytime vim launched:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

I had no error when connection from a PC with putty, so the problem was on Mac OSX. After some time I finally understood that my locale was not properly set on the Mac and the following command in the terminal did the trick:

export LC_ALL=$LANG

Restart terminal.

Problem solved.

It the problem persists, you can add this line in your init script on your server:

echo "export LC_ALL=$LANG" >> ~/.zshrc

Now chocolate time!