Setting SSH locale properly in OS X

by , , revisited on

We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

Ever seen a message in your iTerm or Terminal apps telling you there’s a problem setting locale?

It may be when you run a Perl app:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = “en_US.UTF-8”
are supported and installed on your system.

Or even more likely, once you initiated a connection to remote server via SSH:

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

There are many ways you can find online suggested as the fix. But what is the scientifically correct answer to the problem?

Many suggest that your server is flawed and is missing a locale. They suggest to generate one. But it’s not technically a valid locale “UTF-8”.

Your server is not flawed. OS X default SSH client configuration is.

Add to your ~/.profile:

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: