CPAN on Snow Leopard

CPAN, the Comprehensive Perl Archive Network is a free community provided library of Perl programs.

Installing CPAN

Here are instructions for setting up a 64-bit CPAN on Snow Leopard, tested August 2010 with 10.6.4. For the most current version of OS X, see CPAN instructions for Sierra (10.12).

These instructions assume you have already disabled .my.cnf and reinstalled MySQL.

(Gotcha:) For some reason, when I tried this in 2010, sudo -H cpan failed. where cpan said it was there. It turned out that something had changed the access on /usr/bin/cpan to 666. I changed it to 755 and all worked.

Problems

CPAN on El Capitan failed installing DBD::mysql with the message

  # Failed test 'dbh insert id 0 == max(id) 2 in dbd_mysql_t31'
  # at t/31insertid.t line 58.
  # got: 0
  # expected: 2
  # Looks like you failed 1 test of 18.

I had to do force install DBD::mysql and that seemed to work.

On El Capitan, CPAN asked me to set some more environment variables after setting up CPAN. I set it up like so:

    export PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.22
    export PERL_LOCAL_LIB_ROOT="/opt/local/lib/perl5/5.22"
    export PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.22""
    export PERL_MM_OPT="INSTALL_BASE=/opt/local/lib/perl5/5.22"

Home | FAQ © 2010-2017, Tom Van Vleck updated 2017-07-25 14:15