[VPM] TIP: fixing a common Perl 5.8 problem on Mac OS X
Darren Duncan
darren at DarrenDuncan.net
Sat Feb 7 00:47:14 CST 2004
Hello. This is a tip for any of you who have run into a certain annoying
warning that some Perl installs give off every time they are run, and you
don't know how to stop it. I recently had this problem and didn't know
how to solve it either, until now. Specifically, Perl says something like
this:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Perl still continues to do its work as usual, but it is noisy. From my
searches on the internet, I found that many people had complained about
this problem, some going back to 1998 or so, and it occurred on many
different platforms. A significant number of postings dealt with Mac OS
X, and I eventually found a solution among them.
This is the message thread I found with the solution:
http://www.mail-archive.com/macosx@perl.org/msg05650.html
What you need to do is edit or create the following file:
~/.MacOSX/environment.plist
aka
/Users/<your-user-name>/.MacOSX/environment.plist
It should look like this on the inside:
<?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>en_US</string>
<key>LC_ALL</key>
<string>C</string>
</dict>
</plist>
Note that, in my situation, neither the file nor the ".MacOSX" folder
existed yet, so I had to create both. The text file has Unix line breaks.
The above details in the file came from the posted solution online, so
some details like the plist version or the DTD url don't necessarily have
to be the same, and the file can have additional content. When creating
the ".MacOSX" directory, you will have to use the command line, since the
Finder won't let you. But you can open said folder in the Finder after it
is made and use it to put the file there if you want.
After you add this file, log out and then log in again. When running
Perl, the problem has gone away.
As a bit of background, I had started off with a Mac OS X 10.2.6 system
and a built from source copy of Perl 5.8.1rc4; this I had a week ago and
it all worked well. I started encountering the above problem after doing
a fresh install of 10.2.8, but left the Perl the same (it was on a
different partition); the Perl still ran except for that warning.
Thinking perhaps that my Perl may have become damaged, and before I did
the online search, I installed Perl 5.8.3, from source, but it gave the
same warning. Note that, throughout this whole time, the Perl 5.6.0 that
came with the operating system never gave the warning once.
I hope this has helped someone. Note that I have never seen mention of it
on these lists before.
-- Darren Duncan
More information about the Victoria-pm
mailing list