«

»

macOS – LC_CTYPE Locale UTF-8 Warning When Using SSH

A while ago I started to get an annoying warning message when using SSH to connect from my MacBook Pro, running macOS Mojave version 10.14.6, to some, not all, remote systems using the built-in Terminal application, iTERM2 or whatever other application providing a SSH capability. Error message:

You can read more about UNIX environment variables, including LC_TYPE, here

In a terminal session on your MacBook you can get information about current locale for standard output by running command “locale” and/or “locale -a” where -a provides additional information.
The locale command on my MacBook gives:

LANG=
LC_COLLATE=”C”
LC_CTYPE=”UTF-8″
LC_MESSAGES=”C”
LC_MONETARY=”C”
LC_NUMERIC=”C”
LC_TIME=”C”
LC_ALL=

To get rid of the warning message you can just comment out the below line in the /etc/ssh/ssh_config (not the sshd_config) file:

SendEnv LANG LC_*

And you use the # sign to comment out a line meaning end result will be like:

# SendEnv LANG LC_*

There you go, now you can SSH to systems that does not support UTF-8 as locale without getting the warning message.