I recently encountered a problem when logging through SSH in to certain servers that I use for work when using my new Macbook Pro (running Lion 10.7.3).
So right after the login was completed I was getting the following message:
warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)
It only happened on certain servers, for others everything would work just fine.
This caused a few problems when running some perl scripts that would complain about the locale variables not being set, even though my Terminal app was setup correctly.
To fix this I simply added the following to my ~/.bash_profile:
export LC_CTYPE="en_US.UTF-8"
Let me know if that helped you by leaving a comment below!
Worked great thanks.
indrajit
Thank you very matched
thanks much!!! works great!
Thanks!
Here’s what worked for me on OS X 10.8:
1. Edit or create .bash_profile on the Mac and add the following line:
export LC_ALL="en_US.UTF-8"2. Open the terminal preferences (Option+,), go to Settings -> Advanced and un-check “Set locale environment on startup” (we want to let .bash_profile to take care of that).
HTH
Thanks man … Worked perfectly
Worked like a charm. Thanks!
Thank you very much- worked great!
You may also need to install the locale:
locale-gen en_US.UTF-8
At first, It didn’t help me as I try to export that variable in shell. But later, after setting “LC_ALL” to null value, it worked perfectly fine.
Good work. Thanks.
[...] to bergspot Filed Under: SSH and shell [...]
Hi,
I envy that it works for a lot people but not mine. I’ve put them both on .bashrc and .bash_profile. Im running RHL4.x. Please help.
Thanks for the tip. I was getting those messages when pressing “tab” to get the full dir/file name automatically in command line.
I’ve entered it in the .bashrc file, then did a “. .bashrc” (which allows it to update without having to restart the terminal window) and it fixed the issue..
Just what I needed
Thanks!
Great! TY!!!! Worked great!
Worked great!
Thanks…
It worked . Thanks
Put that line in ~/.profile on the Mac and the warning went away. Cause is that I have my Mac set to German but log into systems set to English.
Thanks for the tip!
Thank you man, it’s worked for me !
It worked for me too. Mountain Lion 10.8.1
This really helped a lot. thanks a ton!
Only worked for me after create bash profile on my Mac using Terminal. Really good tip, but I have no shure if it is really necessary to put in the server side profile (maybe it only works when added into both sides?)
Thanks!
Works for me. Thanks!
Concise and effective. I was looking for a quick fix and found it, thanks.
i add export LC_CTYPE=”en_US.UTF-8″ in my .profile file so its works very well and remove irritating warning: setlocale: LC_CTYPE: cannot change locale (UTF-8). Thanks
Nice
Possible cause: Have my computer installed with english as system language but with danish keyboard.
Note that it won’t directly work if you reconnect to an existing GNU Screen session. So first close your existing sessions… Makes sense, but took me a minute to figure out.
works too! I’m working on a server in germany and had the same problem, maybe the keyboard was set to be in german?
Thanks a lot!
Thanks a lot! I was bugged by this warning for several months now.
Thanks, first put in .bash_profile on the server, but had to put in .bash_profile on my Lion host off course.
It helped!Thank you!
Alex
Great!
Thanks, it works!