perl: warning: Setting locale failed.
1 min read

perl: warning: Setting locale failed.

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

[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.

# 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

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

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