Site icon GetPageSpeed

Setting SSH locale properly in OS X

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),
LC_CTYPE = “UTF-8”,
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
Exit mobile version