Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Installing XML::Simple - CPAN

I need some help, I've been trying to install the CPAN module XML::Simple on OS X Lion 10.7.3 so far with no good results.


I installed this on my linux mint machine in no time but for some reason the simple task had turned onto a project on the Mac.


I found an old posting for setting up the CPAN modules on Mac but I haven't been able to applied to my environment.


------- this is the old post ---------------



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->addparser(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!






-------- end of old post ---------------------



This is where I have gotten so far:


to get in CPAN I use sudo cpan <enter>


cpan[6]> cpan[6]> install XML::Simple

Going to read '/Users/josephhandschu/.cpan/sources/authors/01mailrc.txt.gz'

............................................................................DONE

Going to read '/Users/josephhandschu/.cpan/sources/modules/02packages.details.txt.gz'

Database was generated on Mon, 13 Feb 2012 00:12:32 GMT

..............

New CPAN.pm version (v1.9800) available.

[Currently running version is v1.9456]

You might want to try

install CPAN

reload cpan

to both upgrade CPAN.pm and run the new version without leaving

the current session.



..............................................................DONE

Going to read '/Users/josephhandschu/.cpan/sources/modules/03modlist.data.gz'

............................................................................DONE

Going to write /Users/josephhandschu/.cpan/Metadata

XML::Simple is up to date (2.18).

Then I get out of CPAN



cpan[11]> exit

Terminal does not support GetHistory.

Lockfile removed.

Josephs-MacBook-Air-2:/ josephhandschu$ cd ~/.cpan/build/XML-Parser*

Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl^C


Try to run the Makefile.PL


Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl Makefile.PL EXPATLIBPATH=/usr/X11R6/lib EXPATINCPATH=/usr/X11/include

Couldn't find your C compiler

Compilation failed in require at Makefile.PL line 5.

BEGIN failed--compilation aborted at Makefile.PL line 5.

Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$


or with a shorter version taking the default parameters



Josephs-MacBook-Air-2:XML-Parser-2.41-2ew4TC josephhandschu$ perl Makefile.PL

Couldn't find your C compiler

Compilation failed in require at Makefile.PL line 5.

BEGIN failed--compilation aborted at Makefile.PL line 5.


But this complains about not finding the C compiler


Any ideas?


Suggestions are greatly appreciated, I've hitted a wall....


Joseph.

MacBook Air, Mac OS X (10.7.3)

Posted on Feb 14, 2012 6:14 PM

Reply
8 replies

Apr 12, 2013 9:16 AM in response to joe0867

(I'm using the bash shell below. If you use csh, some of these commands won't work.)


It sounds like the compiler is not in your PATH. Test this by:


$ which cc


My guess is that nothing will be returned by that command.

You've already installed XCode, so it should be on your system. If your locate(1) database is up to date, the fastest way to find the compiler is this:


$ locate cc | grep /cc$


On my machine (OS X 10.7), the compiler is /Developer/usr/bin/cc so I added /Developer/usr/bin to my PATH:


$ export PATH="$PATH:/Developer/usr/bin"


And obviously add that to your ~.bashrc file.

Installing XML::Simple - CPAN

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.