Tag Archives: perl

How to fix a locale setting warning from Perl and/or *nix bash?

Perl is sometime called by a *nix script and, after an update I get recently this warning message (in particular when I run apt or npm command):

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

This can be fixed simply adding the following lines to your bashrc or bash_profile on the host machine:

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Tagged ,