Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

CPAN Useless on OS X

by HalNineThousand (Beadle)
on Oct 15, 2013 at 07:44 UTC ( #1058251=perlquestion: print w/replies, xml ) Need Help??
HalNineThousand has asked for the wisdom of the Perl Monks concerning the following question:

I'm using OS X, 10.8.4 and I'm having trouble with CPAN. It doesn't seem to matter what I install, I get errors and can't build anything. I've tried to re-install it and, just in case I was missing something, used this as a guide. I moved ~/.cpan (/var/root/.cpan) to /var/root/.cpan-bak) and tried running cpan, but whatever I've done it never asks for any configuration issue.

While I've done work in C++ and Java, that was a while ago and I've had to do very little in terms of using make or building programs, so that's a skill I lack.

It seems to me that if things are working, if I start without the configuration directory, that when I build and install CPAN, on the first run it should be asking me for configuration information, but it doesn't - and I think the reason I'm having trouble installing anything is probably because of configuration issues, probably from when I upgraded the OS at one point.

What can I do to force a clean install of CPAN and force it to reconfigure?

Replies are listed 'Best First'.
Re: CPAN Useless on OS X
by marto (Bishop) on Oct 15, 2013 at 07:52 UTC

    I suggest you leave the system perl alone. Messing around with the system perl (and vendor supplied modules) can result in an unstable OS. It's trivial to install your own perl elsewhere on the system. See this thread for details of the problem, various solutions and other OSX prerequsites which may be requied.


    "...force it to reconfigure"

    for future reference if you want to reinitialise the configuration of cpan:

    cpan> o conf init
Re: CPAN Useless on OS X
by herveus (Parson) on Oct 15, 2013 at 12:41 UTC

    That's really puzzling. I have been using Perl and CPAN on OSX from 10.0 through 10.8.mumble.

    I installed my own edition of Perl in /usr/local/bin using sudo (which is how you are supposed to do privileged access), and my CPAN configuration is set to do "sudo *mumble*" for the install actions. It has always worked smoothly.

Re: CPAN Useless on OS X
by hdb (Prior) on Oct 15, 2013 at 07:48 UTC

    You are running cpan under sudo, right?

      I used su.

        Can you post some of the typical errors you get? Otherwise, it is difficult to guess what the problems might be.

Re: CPAN Useless on OS X
by sundialsvc4 (Abbot) on Oct 15, 2013 at 13:56 UTC

    I strongly recommend that you treat it more-or-less like a “install CPAN as a non-root user” situation, as is very well-documented elsewhere.   Set up your own directory, entirely separate from the system ones, and designate this as your installation target for CPAN. Put it ahead of the others in PERL5LIB.   When cpan is properly configured, it works normally.

    OS/X uses Perl for a lot of things.   You don’t want to put that in jeopardy, so keep your hands off sudo.   It also frequently upgrades the Perl version when going from one major OS-release to the next.

Re: CPAN Useless on OS X
by graff (Chancellor) on Oct 16, 2013 at 01:18 UTC
    When I recently updated my mac laptop to 10.8.5 ("Mountain Lion", I think?), I found that the Perl upgrade that came with it was (of course) not able to run a lot of my scripts, because a lot of cpan modules had to be reinstalled into the new perl lib directories.

    And in order to get those modules installed, I had to install the OSX Xcode package, which includes things like "make" and so on. Are you sure that "make" is currently available on your mac?

Re: CPAN Useless on OS X
by ltriant (Scribe) on Oct 16, 2013 at 03:16 UTC

    I had lots of problems with perl on OS X. When I first started using OS X years ago, I tried installing everything via MacPorts. Then I realised not all modules are in MacPorts, so installing either way can clobber the other. And sometimes you install something via MacPorts and it also upgrades your Perl as a dependency and now your newer version of perl can't see the old modules, so you need to install everything again, or mess around with the library paths.

    A couple of months ago I installed perlbrew and cpanm and have been using that instead. So far, so good. Doesn't interfere with the system perl and doesn't interfere with any MacPorts-installed versions of perl. Problem solved (for me, at least).

Re: CPAN Useless on OS X
by kevbot (Curate) on Oct 17, 2013 at 04:59 UTC

    I highly recommend using perlbrew to install your own perl. This will allow you to avoid messing with the system perl. I have been using perlbrew on OS X for a while now, and it has always worked very well (and the installation is very easy).

    After installing a perl with perlbrew, I recommend installing cpanminus. It works very well with perlbrew (see the perlbrew-specific installation instructions for cpanminus). If you set both of these up properly, you should be able to easily install CPAN modules with the cpanm command...and you should not need to use sudo for installing modules.

Re: CPAN Useless on OS X
by jhourcle (Prior) on Oct 17, 2013 at 01:50 UTC

    A few questions for you first ... Do you have `make` installed, a compiler, and the "BSD subsystem"? (I assume MacOS is still calling it that .. I'm not running 10.8.x). If you install Xcode through a regular package (not as an app), it should prompt you for what components you want to install. You must select 'BSD subsystem' or you won't have a perl.h and other important header files. You'd still be able to install pure perl programs (assuming you have `make`, or they're using Module::Build, but the majority of modules will fail).

    The only way that I know to ensure that CPAN is truly clean is to clear out the installed libraries, and start over. (it had been /Library/Perl, but I think they've moved it in either 10.7 or 10.8). You can force a reconfigure from the cpan shell with `o conf init`.

    Personally, I'd advise *against* messing with the system perl too much. I'd had a few times where Apple's patches screwed up one of the libraries that I needed, and I wasted way too much time trying to figure out what had gone wrong. Apple packages such outdated versions of perl that you're really better off just installing a fresh perl in /opt/ or /usr/local/, and keeping your libraries separate from what Apple distributes.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1058251]
Front-paged by Corion
[LanX]: such much?
[LanX]: We are speaking nothing but english now...
erix never really understood the need for rhyming slang
[erix]: it seems so far-fateched and illogical
[erix]: islanders a deviant bunch

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-03-24 18:26 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (305 votes). Check out past polls.