Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN

by tshori (Initiate)
on Feb 04, 2013 at 19:11 UTC ( #1016994=perlquestion: print w/replies, xml ) Need Help??
tshori has asked for the wisdom of the Perl Monks concerning the following question:

Hi Everyone, I was trying to install BioPerl on my Mac, with Mountain Lion on it, and the instructions said to install the Bundle::CPAN module. That installation did not work and now cpan does not work anymore. I get this:

Can't locate ExtUtils/ in @INC (@INC contains: /Library/Pe +rl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Librar +y/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Li +brary/Perl/Updates/5.12.4/darwin-thread-multi-2level /Library/Perl/Up +dates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /Sy +stem/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread +-multi-2level /System/Library/Perl/Extras/5.12 /Users/Thori) at /Syst +em/Library/Perl/5.12/ line 46. BEGIN failed--compilation aborted at /System/Library/Perl/5.12/ + line 46. Compilation failed in require at /System/Library/Perl/5.12/App/ + line 183. BEGIN failed--compilation aborted at /System/Library/Perl/5.12/App/Cpa line 183. Compilation failed in require at /usr/bin/cpan5.12 line 9. BEGIN failed--compilation aborted at /usr/bin/cpan5.12 line 9.

Following this, I had a little freak out, and I used perlbrew to install a local version of perl 5.16. When I tried the same thing, cpan stopped working again, but I fixed it, by resinstalling perl 5.16. Is there anyway other than re-installing the OS, to restore the Native Perl on Mac?


  • Comment on CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN
  • Download Code

Replies are listed 'Best First'.
Re: CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN
by MidLifeXis (Monsignor) on Feb 04, 2013 at 19:21 UTC

    Restore your system version of Perl, and don't mess with it outside of the standard OS-level upgrades. There are OS-level applications that depend upon a certain base configuration to accomplish what they do.

    Instead, use something like perlbrew to manage a second (third, fourth...) Perl installation that you use for development.

    If you use TimeMachine, you should be able to restore the directories in the error messages to a certain state, but that is not something I would look forward to doing by hand.

    Also, please add <code>...</code> tags around your code, data, and error messages to make it easier to read. OP updated with code tags. Thanks.

    Update: Glossed over the majority of the unformatted text as error text. OP has used the perlbrew route and is asking a different question.



      Thanks. The system perl is working fine. I changed $PATH back to the original system perl, and i runs scripts and all of that.

      Do you think I need to worry that the native cpan binary doesn't seem to work? Does the OS install any modules that way, does it even need it?

      Thanks! T.
Re: CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN
by 7stud (Deacon) on Feb 04, 2013 at 19:52 UTC

    It's not clear to me what command you typed to get that error. But it's obvious the error is related to your system perl, which you should leave alone. Were you using the system perl's cpan command to install modules before this?

    I don't think the system perl installs cpan modules. I think the whole idea is that Apple set up your computer by installing perl and configuring perl to allow Mountain Lion to do the things it needs to do. A customer wouldn't be very happy if Mountain Lion wouldn't work correctly without downloading addition modules from cpan. What if the customer didn't have an internet connection?

      I was just trying to run cpan after trying to install the Bundle::CPAN module. The instructions on BioPerl, said to install the Bundle::CPAN module, leave cpan. Get in again and install Module::Build. I when I tried to get back again by typing cpan, it gave me that error. Thanks, for your response in any case, your point makes a lot of sense!

      Cheers, T.
Re: CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN
by 7stud (Deacon) on Feb 04, 2013 at 20:03 UTC

    Another thing: Don't use sudo when installing modules after installing perlbrew. A sudo install post perlbrew will give directories created by the install only root privileges, which will adversely affect subsequent attempts to install modules without sudo, and the whole point of perlbrew is not to have to use sudo.

    If you did use sudo, read this link on how I got the permissions corrected.



        Hi All,

        I am no expert, but I am pretty sure the problem I am having with installing Bundle::CPAN is Mountain Lion specific. I just unearthed my laptop that has leopard on it. I followed you guys advice, installed perlbrew, with a perl 5.16.0 on it and I went into CPAN and installed Bundle::CPAN and it worked like a charm. I just want to leave this hear so people know!.

        Cheers, T.
Re: CPAN won't work on Mountain Lion following attempt to install Bundle::CPAN
by sundialsvc4 (Abbot) on Feb 05, 2013 at 04:09 UTC

    Very definitely, you need to approach this from the point-of-view of “installing Perl as a non-root user” on a shared-hosting machine:   one does not touch, for any reason, the native Perl installation or configuration on the host machine.   You need to define your own local package repository, install your local versions of whatever-you-need there, and make very sure that nothing that you do (or consider doing) has anything to do with “root privileges.”

    Mountain Lion, like Lion, changed the “native” Perl version.   It’s a long way from both Leopard and Snow Leopard.   (And for what it’s worth, I can tell you with authority that there are groups at Apple that were somewhat vexed by this.)   So, you are quite comparing apples and oranges in this case.

      Thanks, everyone. I am really new at this, so anything helps. I have another question. So I set an virtual machine so I can try this things without ruining the system. I followed the suggestion and now I am using perlbrew, with perl 5.16. However, if I try to run cpan now without sudo, it tells me it can't do the installation. I checked the report and it is trying to install the module on the perlbrew folder. What am I doing wrong? You guys indicated that I should not install anything with root privileges, so I am avoiding doing that. Thanks!


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1016994]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2018-06-19 15:33 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.