How to fix locale issues in Mac OS X Lion terminal (Mountain Lion has the same issue)

Posted: January 9, 2012 in Mac OS X, Shell scripting
Tags: , , , ,

I faced a problem with locales in terminal on Mac OS X Lion. Midnight Commander didn’t want to display cyrillic symbols in filenames, on remote Ubuntu I’ve been getting messages like “warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)”. The solution is fairly simple – add these two lines to ~/.bash_profile (by default is seems to be missing, so create the file):

# Setting for the new UTF-8 terminal support in Lion
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Thanks to Allen Bargi’s answer!

P.S.: Mountain Lion has the same issue and it gets solved in the same way.

Comments
  1. Richard says:

    Thanks a bunch, worked like a charm.

    • s32i says:

      thanks, this actually solved the problem. I thought it was something with the server config, but as turned out, it was actually terminal problem.

  2. Roman says:

    Thanx! You are awesome

  3. Nattanicha Phatharamalai says:

    thanks, this is useful

  4. Anton Seretkin (@seretkin) says:

    thank you very much!

  5. Tim Kul says:

    Thanks

  6. Gregory says:

    Found your solution while searching for a Netgear ReadyNAS SSH locale fix. Thanks a lot!
    Do you mind if I translate this into Russian and publish in my blog with a backlink?

  7. btv solo says:

    I think this is one of the so much significant information for me.
    And i am glad studying your article. However wanna statement on few common issues, The web site taste is wonderful, the articles is truly nice
    : D. Excellent activity, cheers

  8. Alexey Scherbakov says:

    Спасибо, Юра!

Leave a reply to Alexey Scherbakov Cancel reply