Wolf’s Little Store

August 5, 2008

How to: suppress Perl locale warning in OSX Leopard

A blog post about a rather uncommon error, but I’m sure this will help some people. The rest of the world, go check out my other website.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LC_CTYPE = "en_US.UTF-8",
LANG = "UTF-8"
are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

If you get this warning when dragging images from the projects drawer to your code in Textmate, you need to edit your .profile file. It’s a hidden file in the home (~/) folder of your user. You can use vim if you know how to work that, but I don’t, so I use Textmate. Use this command to open your .profile file:

mate ~/.profile

If you get an error that the ‘mate’ command is not known, go to Textmate and click Help, then Terminal Usage and finally the Create link button. The ‘mate’ command is a very handy command: go to a folder and enter ‘mate .’ to create a project of that folder; enter mate *.csv’ to create a project of all the .csv files in that folder, and so on.

Add these lines to your .profile file:

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

Problem solved!

One response

Leave a Reply

Write in English, stay on-topic and polite.