# How to fix warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

When you do an SSH to a certain server and execute some command in terminal, you may notice a warning that said "warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)". This caused a few problems when running some perl or installation scripts that would complain about the locale variables not being set. This warning occurs when I am trying to do a remote command to my Ubuntu server through an SSH from my Mac OS X 10.8.4 Mountain Lion computer.

To fix this error, I just edit my .profile file on my home directory (on remote server) and add or uncomment the following line:

export LC_CTYPE="en_US.UTF-8"

Some said that you may add on .bash_profile file rather than .profile file. In my case, I don’t have .bash_profile on my home directory on remote server. Instead of using .bash_profile file, I put the above line on .profile file.