locale: Cannot set LC_CTYPE to default locale: No such file or directory

Here’s another note of a solution to a minor technical annoyance, mostly for myself to find. This thing has been driving me nuts.

I have no idea what I changed, but suddenly, when I ssh into my Linux machine from the MacBook, I was getting these warnings. The locale command said I was using the “en_US” locale, which was a clue. I need the en_US.UTF-8 locale.

The problem is, the mac terminal doesn’t use the UTF-8 locale, but plain en_US. When I type locale on macOS, It reports LANG=”en_US” and LC_CTYPE=”UTF-8″, which seems weird to me, but I have no idea where that gets set (Macs, amirite?), and it hasn’t been a problem so far. But when I ssh into a Linux machine, it becomes an issue, and what ended up working was to set both LANG and LC_ALL to en_US.UTF-8 in my .bash_profile on Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *

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