Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to upgrade the installed perl (5.10) to latest version (5.14).

I have Mac OS X 10.6.8; the pre-installed version of perl is 5.10\. I would like to upgrade this to the latest stable version of perl, which is 5.14 (iirc, 5.15 is a developmental release on the way to 5.16).



Thanks, ed

(aka swampyankee on perlmonks 😉)

Mac OS X (10.6.8)

Posted on Feb 25, 2012 7:56 AM

Reply
Question marked as Best reply

Posted on Feb 25, 2012 8:01 AM

The MacPorts Project -- Home

11 replies

Feb 25, 2012 9:36 AM in response to Linc Davis

Thanks, but I've got MacPorts; its version of perl is 5.12. While this is closer to 5.14 than the system perl (5.10), it's not the latest (I'm doing some module development -- nothing fancy and mostly for my own edification -- and need the "latest and greatest." I figure getting 5.15, the development version, would be similar to upgrading to 5.14)

Jul 1, 2012 2:13 PM in response to emcofct

Meanwhile, to actually answer the question .... there is (of course) another way to do it, the Perlish way. Lion comes with not only Perl, but also CPAN, which is the proper way to upgrade/install Perl and its components. To use CPAN you will also need various development tools (gcc, make) which you can get by installing the command-line developer tools from Apple. (https://developer.apple.com/downloads/index.action)


(Instructions below assume you know how to work on the command line. If not, you almost certainly shouldn't do this.)


  1. Make, or make sure you have, a good bootable backup of your system, just in case.
  2. Run cpan as root or sudo, and answer yes to the automatic configuration question.
  3. Once you get to the cpan> prompt, type "cpan upgrade" to make sure you're on the latest version.
  4. Then, to upgrade Perl, just type "upgrade". This will take a while (5-10 minutes) but assuming it succeeds, you'll be on Perl 5.14 with all of the new features (such as the /r modifier for s/// which is why I upgraded).


If the process fails, CPAN's output is usually pretty informative. Most of the time it's due to permissions problems (did you sudo?) or to a misconfigured compiler. If you've installed your own development tools or messed with your PATH, that could be the problem.


I don't think OSX makes any actual use of Perl; upgrading it had no effect on my system at all. YMMV, of course. I would never start something like this without a bootable backup on hand.

Jul 3, 2012 6:16 PM in response to emcofct

Let me give you some reasons why you shoudn't update Perl: Even though there is a newer Perl version available, your modules may be more portable, especially to Mac users, if you develop and test them using the default installed version.


Say you code up some killer Perl module, and you want to share it with a friend. Or you want to put it on twenty computers on a network. What would be easier? Install your modules and the Perl scripts, or figure out how to Tarball up the old Perl, Tar up the new Perl, copy the new Perl to each computer and un-Tar it, then install your modules and scripts? If you need the new version, go and do it, but it will create a hassle down the road.


Disclaimer: I used to code Perl daily under Solaris, and I knew my way around really well and I installed and moved Perl installations like I was brushing my teeth. That was ten years ago, and I haven't used it much on OS X. While it's fundamentally the same in OS X as Solaris, maybe somebody who's intimately familiar will know exactly how to un-Tar the newest version lickety-split, like I used to. But it's still a royal pain, from a compatibility point of view. Just to make my point, note that vi is still included in every Unix distro under the sun, including OS X. Oftentimes, compatibility is more useful than having the very latest version. Perl is incredibly mature and stable; we'd run Perl scripts 24/7 without any problem under Perl version 4.x. It won't matter whether you use version 5.10 or 5.14.


FWIW, my Lion install has Perl 5.12.3.

Jul 3, 2012 6:30 PM in response to Phoney

Oh, yes, you are absolutely right, if you are using Perl to write something you intend to deliver to end users. Then, yes, the right thing to do is to work in a clean Lion install with only the packages provided in their original versions. (Although, on *nix systems you can compile Perl scripts into binaries, so maybe you could do that on a Mac too? Probably not worth it.)


In my case, however, I'm using my Mac as a development system to deliver code to Linux systems, so I need my local system to have the same version of Perl as the systems to which I am delivering.


I thought you were saying upgrading Perl would be dangerous to the local system. It's safe as long as you're doing it just for yourself, but yes, if you're delivering code to others then you should be working with the default version.

Jul 3, 2012 7:48 PM in response to kenficara

If you bork your Perl installation, Perl won't work correctly, and that's all. The computer won't self-immolate and burn your house down, the time-space continuum will remain intact, etc.


I ran perl -V and it listed a lot of directories, but I only a few contain any Perl stuff:


/Library/Perl

/5.10

/5.12

/System/Library/Perl

/5.10

/5.12

/Extras/5.10

/Extras/5.12

/lib/5.10


I could easily tar up 5.12 and send it to you. 5.14? Maybe score one from a Mountain Lion beta.

Jul 10, 2012 8:53 PM in response to emcofct

This worked for me:

http://learn.perl.org/installing/osx.html


  • Install XcodeUser uploaded file through the Mac App Store (Apple charge a small amount for this, it is a very large download), or from your OSX software DVD/SSD if possible (any version will work).
  • Open the Terminal.app (found in Applications -> Utilities) and copy & paste the command below into it (then press the 'return' key):
    curl -L http://xrl.us/installperlosx | bash
  • Once this is finished (it takes several minutes), quit the Terminal app.


This installs the latest perl (mine is now 5.14.2) into /Users/Phoney/perl5/perlbrew/perls/perl-5.14.2/bin/perl

The default Lion install of 5.10 and 5.12 remain untouched.

How to upgrade the installed perl (5.10) to latest version (5.14).

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.