Skip to content
harry-suryapambagya

perl: warning: Setting locale failed.

Notes on resolving Perl locale warnings by setting LANGUAGE and LC_ALL, with examples for different environments and the Fish shell.

updated 1 min read

You may ever facing this issue, and yes so do I.

Terminal window
[root@server ~]# some command here
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

For this, we just need to set the environment variable.

Find your shell profile. Maybe in ~/.profile /.bash_profile fish shell, etc.

Then set this environment variable.

Terminal window
# Windows
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# MacOS
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Fish
set -gx LANG "en_US.utf-8"

Reload your shell, and try to re-run your command.

[root@server ~]# some command here
ITS WORKS!