2

When OS X El Capitan arrived, the ability to use CPAN to add or update Perl modules disappeared. It seems that the scripts either want to alter /usr/bin, which is now prohibited, or they try to use binaries from /sw/usr/bin which aren't there and are in /usr/bin instead. Perl itself can't be installed because it wants to install into /usr/bin instead of /usr/local/bin.

Where are the scripts that use these /sw/usr/bin? It seems they should use a PATH to locate binaries instead of hard-coding them.

Does anyone know how to fix Perl and CPAN on El Capitan? Detailed instructions would be helpful.

Lætitia
  • 663

1 Answers1

2

I had no issue adding new CPAN packages to the OSX El Capitan shipped perl. By default, they are built in your home directory and installed in /Library/Perl/5.18/ which is writable with root privileges.

The /sw/ prefix you mention seems to come from a Fink installation. If you previously installed another perl from Fink, you probably need to update your Fink installation and update the perl package coming from it.

If you're sure you're not using Fink and you want to run another perl version alongside the one provided with OS X, you can use the one from homebrew. It will install in /usr/local and will be available for you to call it, but all OSX perl programs will keep on using the perl version shipped with OSX. Beware that Fink and Homebrew don't play well with each other, it is better to stick to a single one.

Finally, if you want to run multiple perl versions and be able to switch back and forth between those, I'd suggest you have a look at perlbrew.

Some other useful commands to debug your perl installation further:

  • which perl will tell you where your current perl exec is installed
  • perl -V will give you more information about the perl version, its compiled date and options and the include paths that are searched for modules
  • perldoc perllocal will list you the perl modules that you installed locally with CPAN

About CPAN, as you noticed, a regular CPAN upgrade fails. There is however a solution by telling CPAN to install in /usr/local/bin/. I have documented that CPAN upgrade in this answer.

Lætitia
  • 663