Fixing CPAN on Snow Leopard (Mac OS X 10.6)

I ran into some problems with Perl’s CPAN installer on Snow Leopard, notably, it didn’t work once Bundle::CPAN was installed. Every time I tried to install a package I’d end up with an error like this:

Catching error: 'Can\'t call method "value" on an undefined value at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/IO/Uncompress/ line 64.
' at /System/Library/Perl/5.10.0/ line 281
CPAN::shell() called at /usr/bin/cpan5.10.0 line 199

Not good. So, how to fix it? Move the broken IO::Uncompress module out of the way. In a terminal window, copy and paste the following

sudo mv /System/Library/Perl/5.10.0/darwin-thread-multi-2level/IO/Uncompress/ /System/Library/Perl/5.10.0/darwin-thread-multi-2level/IO/Uncompress/

Once that’s been shifted out the way, it should work provided CPAN was configured with the proper paths to your tar, bzip2 and gzip executables (if not, nuke your /System/Library/Perl/5.10.0/CPAN/ and start over).

Note: This isn’t a long-term solution, some things like CPAN::SQLite won’t install if IO::Uncompress::RawInflate is missing, but at least it gets some functionality back into CPAN. I’m very interested in hearing of any better fixes for this.

2 thoughts on “Fixing CPAN on Snow Leopard (Mac OS X 10.6)

  1. This probably broke when you did a previous install in cpan. They same issue existed in Leopard. It is a pretty well known problem.

  2. Thanks man it works!
    I encounter such a problem when i was installing bioperl with cpan on my new mac, i never met such a problem before as I was working in linux and window. This really helps.

Leave a Reply

Your email address will not be published. Required fields are marked *