- Having the terminal complain about invalid locale settings:
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
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
- Being unable to correctly type some characters (such as accented characters).
- Having programs that tunnel their traffic over SSH, such as Subversion, complain about invalid locale settings during their operations:
svnserve: warning: cannot set LC_CTYPE locale
svnserve: warning: environment variable LC_CTYPE is UTF-8
svnserve: warning: please check that your locale name is correct
svnserve: warning: cannot set LC_CTYPE locale
svnserve: warning: environment variable LC_CTYPE is UTF-8
svnserve: warning: please check that your locale name is correct
In fact, if you look for example at the output of the locale command seen previously, you can see how the LC_CTYPE variable is set UTF-8 while all other LC_* variables (excluding the empty LC_ALL), are set to en_US.UTF-8 (which are correct according to that server settings).
What is the SSH client shipped with Lion doing? Apparently sending incorrect values to the server. It's not just a nuisance having to fix them after logging in, provided you're able to do so: this behaviour is breaking other programs tunnelling their traffic over SSH, such as Subversion, that aren't establishing an interactive SSH tunnel for the user.
Fortunately, the fix is quick: just tell the SSH client not to send any LC_* variable:
- Open the SSH client configuration file (/etc/ssh_config).
- Comment out the line that instructs the SSH client to send those variables (SendEnv LANG LC_*) from the general host configuration section (Host *). You should end up with the following fragment:
Host *
# SendEnv LANG LC_*
The configuration change will be immediately applied to any SSH session opened from now on.
Hope this helps.
35 comments:
Thanks for the help :)
You're welcome. ;)
Many thanks
You're welcome, I'm glad it helped.
This helped solve my problem. Thanks!
wow, finally correct characters in ssh screen irssi session! thanks
You're welcome.
Thank you for helping fix this issue!
Thanks. It works for Mountain Lion as well.
Tom, you're welcome.
You're welcome, thanks for the report.
Thanks for writing this up.
You're welcome, I'm glad it helped.
Wow! I didn't expect to find such a precise solution when I googled "Mac LC_CTYPE polluting SSH." Now I have to go and delete all the /etc/default/locale files I've created on my servers.
Talk about a subtle root cause!
Hi Kevin, you're welcome, and I'm really glad this post helped you!
awesome .. made my day!
You're welcome, I'm glad it helped!
Thanks, this fix worked for me.
Thanks, this helped me too.
You're welcome! Glad it helped.
Nice to hear that, I'm glad it helped you!
Thanks a lot! It finally solves this little annoying problem!
Great post. Thanks a lot. :)
Thank you! This has bugged me for months!
You're welcome Dennis.
You're welcome Lalo.
I'm glad it helped you, Leo.
Thanks, it works on Mavericks 10.9.3 terminal.app ssh-ing into Linux RHEL 6.4 too
Dharmesh Shah
Finally, a solution to my problems. Irssi will be fun again. Thank yu!
Thanks!
First post is from 2012 and it still helped today!
Thanks!
Aaaaaah! *That* was it!!!!! A million thanks.
Thanks Grey. Appreciate it.
+1
Thanks for the quick fix!
Post a Comment