manpath: can't set the locale; make sure $LC_* and $LANG are correct
When I ssh
into an EC2 instance running Ubuntu 18.04, I get this error:
manpath: can't set the locale; make sure $LC_* and $LANG are correct
I tried this but this didn't fix it:
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TERMINAL_VERSION = "3.3.7",
LC_CTYPE = "UTF-8",
LC_TERMINAL = "iTerm2",
LANG = "C.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.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
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LC_TERMINAL_VERSION = "3.3.7",
LC_TERMINAL = "iTerm2",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LC_TERMINAL_VERSION = "3.3.7",
LC_TERMINAL = "iTerm2",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Another option is to disable sending LC_* environment variables. Refer to https://stackoverflow.com/questions/29609371/how-do-not-pass-locale-through-ssh , these steps fits for MacOS ssh client :
sudo vi /etc/ssh/ssh_config
Find these settings:
Host *
SendEnv LANG LC_*
Change it to :
Host *
# SendEnv LANG LC_*
Save the file, then try connecting again.
Thanks to Gunnar Hjalmarsson I'm able to use this workaround:
unset LC_CTYPE
in ~/.profile