How can I restore my Perl environment and modules to a known state on Mac OS X? [closed]

None of the projects you mentioned installs into system directories. So, removing them from your current user environment should be as trivial as taking them out of your path, and removing references to them from your startup files (e.g., .bashrc, or if you added them to your "login items" etc).

After that, you'd be left with what the OS gives you. LEAVE THAT ALONE. Install perlbrew (so you can install multiple perls and switch among them without disturbing the rest of the system) and cpanm (cause it's more funner ;-) and take it from there.

Make sure to read the documentation for everything you use so you understand what they do and how they do it.

PS: If you did force any of fink, ports, or homebrew trample on system directories for some reason, you did it wrong. If I were you, I would choose to install from scratch in such a case (but make sure to back up your documents first). I personally think even /usr/local as homebrew developers advocate is not a good idea, but if you did that, at least they give you an uninstall script.


OS X and Perl = pain a bit, when want many modules.

Problems:

  • macports - default 5.12 optional 5.14. Unfortunately many macports has wrong dependencies, asking exactly 5.12 and when you have 5.14 running into problems Your default perl will be 5.14 and some packages will install and use 5.12 :(.

  • perlbrew - very good and easy but here is a drawback. When you want install some packages with macports and what are depend on macport's perl - it's get installed. So you will get one macport's perl (what will works with installed package and perlbrew perl). And what is worse, your e.g. 5.14 perlbrew will not play correctly with macports (default 5.12). E.g. p5-GD, ImageMagick and many many others.

  • homebrew - IMO, horrible. Stopped reading the doc when reach a section recommending rm -rf /usr/local. (of course, with all data, e.g. mysql). Maybe now it is better.

  • fink, same problems as macports.

My solution:

simple using macports version for real development and perlbrew only for testing (but not with dependent binaries, like GD and so on). When want "perlbrew" sourcing its shell-start-files, otherwise not and using macports.

Another source of pain is - trying install macports version of perl modules first (because of consistency and dependency) and only when macports version is not exists, or need the newest cpan version - installing it with cpanm. CPAN version Extutils::Makemaker does not like macports version - and recompiling it all times when installing modules with cpanm.

Real pain. Macports badly need a new perl - maintenaier, who will clean up wrong dependencies and make the macports version of cpanm what will install cpan version of modules correctly as macport packages. Something has FreeBSD has years ago - cpan modules comes into BSDPAN bundles what are manageable with pkg_* commands.

So the result: I'm currently don't known any easy OS X perl usage. immediately when you want use some perl-dependent software you will must compile them itself (and sometimes they will not compile - so you need the patched version for OSX, so start uses macports or homebrew and ... pain.. ;(

As Sinan already told - any of those installations does not interfere with your system perl, but you probably started using cpan first with system perl and installed some modules into /Library..

IMO, you can live with it. Simply install macports and start using it. But if you want some perl-repair-installation - probably the better place to ask is at: https://apple.stackexchange.com/ .