Installing XML::Simple Perl module on 10.4.8
Two of my friends today asked me to help them get XML::Simple working on their Mac's. Somthing that should be a simple cpan one-liner "install XML::Simple" doesnt work on OSX. It took me a half hour to figure all this out... here are the steps:
Prerequisites:
- X11 1.1.3 package from the OSX install disk (or Apple download site)
- Perl 5.8.x w/cpan (default on OSX)
- a terminal
- A reasonable working knowledge of Perl and Unix
Step 1:
Open terminal, type 'cpan' to enter the cpan installer.
cpan> install XML::Simple
It will ask you three times if you want to follow the prerequired modules. Hit enter every time. Eventually you will get a dozen test failures. These are in XML::Parser, a required module.
Step 2:
cpan> exit
$ cd ~/.cpan/build/XML-Parser-2.34 **Note the version may change
$ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11R6/include
$ make test
$ make install
Step 3:
Back to cpan...
$ cpan
cpan> install XML::Parser
Already Installed
cpan> install XML::Parser::Expat
Already Installed
cpan> install XML::SAX::Expat
Installs with some silly warning about ParserDetails.ini. Lets fix that.
cpan> exit
Step 4:
Here is the command/code to add Expat to the ParserDetails.ini file. If we don't, we can't proceed past this point.
$ sudo perl -MXML::SAX -e "XML::SAX->add parser(q(XML::SAX::Expat))->saveparsers()"
Step 5:
Back to cpan to finish the install
$ cpan
cpan> install XML::Simple
Hit enter if it asks you anyting. The whole thing should work.
cpan> exit
Step 6:
Verify XML::Simple existance with:
$ perl -MXML::Simple -e '1;'
If you don't get an error, you're all done!
Enjoy.
Macbook Pro 15" C2D Mac OS X (10.4.8)
Prerequisites:
- X11 1.1.3 package from the OSX install disk (or Apple download site)
- Perl 5.8.x w/cpan (default on OSX)
- a terminal
- A reasonable working knowledge of Perl and Unix
Step 1:
Open terminal, type 'cpan' to enter the cpan installer.
cpan> install XML::Simple
It will ask you three times if you want to follow the prerequired modules. Hit enter every time. Eventually you will get a dozen test failures. These are in XML::Parser, a required module.
Step 2:
cpan> exit
$ cd ~/.cpan/build/XML-Parser-2.34 **Note the version may change
$ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11R6/include
$ make test
$ make install
Step 3:
Back to cpan...
$ cpan
cpan> install XML::Parser
Already Installed
cpan> install XML::Parser::Expat
Already Installed
cpan> install XML::SAX::Expat
Installs with some silly warning about ParserDetails.ini. Lets fix that.
cpan> exit
Step 4:
Here is the command/code to add Expat to the ParserDetails.ini file. If we don't, we can't proceed past this point.
$ sudo perl -MXML::SAX -e "XML::SAX->add parser(q(XML::SAX::Expat))->saveparsers()"
Step 5:
Back to cpan to finish the install
$ cpan
cpan> install XML::Simple
Hit enter if it asks you anyting. The whole thing should work.
cpan> exit
Step 6:
Verify XML::Simple existance with:
$ perl -MXML::Simple -e '1;'
If you don't get an error, you're all done!
Enjoy.
Macbook Pro 15" C2D Mac OS X (10.4.8)