CPAN on Snow Leopard
CPAN, the Comprehensive Perl Archive Network is a free community provided library of Perl programs.
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 Mojave (10.13).
These instructions assume you have already disabled .my.cnf and reinstalled MySQL.
- If you have a /var/root/.cpan, rename it or delete it.
- Change your shell environment to export ARCHFLAGS="-arch i386 -arch x86_64"
- Change your shell environment to export VERSIONER_PERL_PREFER_32_BIT=no to avoid errors from dyld
- This process will ask a lot of questions at the beginning, about where to fetch files from and whether to install dependencies. Just keep saying OK, etc.
sudo -H cpan
Then install the modules you want. The ones I use are:
- install Bundle::CPAN
- install DBI
- install XML::Simple
- install Crypt::CBC
- install Crypt::Twofish
- install News::NNTPClient -- set NNTPSERVER first
- install DBD::mysql -- MySQL must be installed first and no root password
- install Net::DNS, Geo::IP::PurePerl, Digest::SHA, Compress::Raw::Zlib, Compress::Raw::Bzip2
- In the future, I may try install W3C-LinkChecker, URI, CSS::DOM, HTML-Parser, Time-HiRes but some of these get errors
- Set the MySQL root password with mysqladmin -u root password WHATEVER .
- Reinstate .my.cnf
- mysql dbname < db.sql
(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.
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 PERL_MB_OPT="--install_base "/opt/local/lib/perl5/5.22""
Home | FAQ
© 2010-2020, Tom Van Vleck
updated 2020-02-25 08:52