Last Updated: February 25, 2016
· sebastialonso

warning: Setting locale failed.

In many of my Digital Ocean's droplet I sometimes get this whenever I'm installing something:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "es_CL.UTF-8",
    LC_MONETARY = "es_CL.UTF-8",
    LC_CTYPE = "en_US.UTF-8",
    LC_ADDRESS = "es_CL.UTF-8",
    LC_TELEPHONE = "es_CL.UTF-8",
    LC_NAME = "es_CL.UTF-8",
    LC_NUMERIC = "es_CL.UTF-8",
    LC_PAPER = "es_CL.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

Given it's just a warning, I tend to dismiss it. But when installing some packages, most notably postgres this may cause an issue.

How to solve it

Go to /etc/environment:

sudo vim /etc/environment

Append this the file:


or any other value. I'm in Chile, but I always use everything in English, so I chose en_US,

Then just the reboot the machine

sudo reboot

And that's it.