Fix Perl locale warning on Mac OS X 10.5

With the default settings on a Mac OS X 10.5 system, perl scripts will issue a warning that the locale has not been set properly. The warning will look similar to this:


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LANG = "UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To fix this issue, create a folder in you home directory called .MacOSX (if it doesn’t already exist). Create a text file in that folder, calling it environment.plist and giving it the following content:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM
"file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>LANG</key>
<string>UTF-8</string>
<key>LC_ALL</key>
<string>C</string>
</dict>
</plist>

You then need to log out and back in again for the changes to take effect.

One thought on “Fix Perl locale warning on Mac OS X 10.5”

Comments are closed.