perlbrew on OSX

I’ve tried and failed so many times to use perlbrew on OSX.

I’ll admit that I haven’t started a full-on investigation, but this is really quite frustrating and confusing:

➔ perlbrew install perl-5.20.0
Fetching perl 5.20.0 as /Users/c.wright/perl5/perlbrew/dists/perl-5.20.0.tar.bz2
Download http://www.cpan.org/src/5.0/perl-5.20.0.tar.bz2 to /Users/c.wright/perl5/perlbrew/dists/perl-5.20.0.tar.bz2
Installing /Users/c.wright/perl5/perlbrew/build/perl-5.20.0 into ~/perl5/perlbrew/perls/perl-5.20.0

This could take a while. You can run the following command on another shell to track the status:

  tail -f ~/perl5/perlbrew/build.perl-5.20.0.log

perl-5.20.0 is successfully installed.

➔ perlbrew switch perl-5.20.0
➔ which perl
/Users/c.wright/perl5/perlbrew/perls/perl-5.20.0/bin/perl

➔ perlbrew install-cpanm

cpanm is installed to

    /Users/c.wright/perl5/perlbrew/bin/cpanm

➔ cpanm MP3::Info
--> Working on MP3::Info
Fetching http://cpanmirror.wtf.nap/authors/id/D/DA/DANIEL/MP3-Info-1.24.tar.gz ... OK
Configuring MP3-Info-1.24 ... OK
Building and testing MP3-Info-1.24 ... OK
Successfully installed MP3-Info-1.24
1 distribution installed

➔ perl -MMP3::Info -e1
Can't locate MP3/Info.pm in @INC (you may need to install the MP3::Info module) (@INC contains: /Users/c.wright/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/darwin-2level /Users/c.wright/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0 /Users/c.wright/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0/darwin-2level /Users/c.wright/perl5/perlbrew/perls/perl-5.20.0/lib/5.20.0 .).
BEGIN failed--compilation aborted.

➔ /Users/c.wright/perl5/perlbrew/bin/cpanm MP3::Info
MP3::Info is up to date. (1.24)

sigh

10 Comments

Have you sourced?

source ~/perl5/perlbrew/etc/bashrc

The output of cpanm -v MP3::Info would be very helpful in tracking down the problem.

The problem is that you are installing modules into a local::lib, but that directory isn't part of the library search path. PERL_CPANM_OPT=--local-lib ~/perl5 means that things are always installed into ~/perl5, but the corresponding PERL5LIB isn't set up to load from there. With perlbrew, you can either install modules directly into perl's normal paths by dropping the local::lib entirely, or you can use perlbrew's built in local::lib support.

perlbrew lib create base; perlbrew switch perl-5.20.0@base

> As always ... it was down to me doing something daft.

So it is for all of us :)

Leave a comment

About Chisel

user-pic