Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Are there any major Perl issues with Mac OS X Lion?

by kcott (Canon)
on Sep 06, 2011 at 02:57 UTC ( #924320=perlquestion: print w/replies, xml ) Need Help??
kcott has asked for the wisdom of the Perl Monks concerning the following question:

G'day Monks,

I'm looking at changing to a Mac environment and I'm wondering if there's any major Perl-related gotchas I should be aware of.

Looking at Apple's current offerings, I expect to be purchasing a Mac Pro with OS X Lion. I have no experience with Mac OS X (see Background below for other details).

Being new to the Mac world, my biggest problem is probably not knowing what questions to ask. Here's a non-exhaustive list:

  • In order to build perl/modules, it seems I need to first install Developer Tools (following advice found in Installing make on mac LION osx). Anything else?
  • Assuming the previous point is resolved, are there any issues with CPAN or related tools (e.g. cpan, cpanp, etc.)?
  • Are there any major groups of modules that are not intended to work in a Mac environment? For instance, I'd guess anything in the Win32:: namespace won't work; but I could be wrong.
  • I note there's quite a few Mac:: modules on CPAN. Any advice on these?
  • Do I need to know anything specific about things like forking, using threads and so on?

I've had a look at OS X Lion Technical Specifications: Perl is only mentioned by name; the version is not given; no further links are provided.

Background: If it helps with your response, my current home setup is WinXP (Strawberry Perl 5.12.0) with Cygwin (Perl 5.12.0 built from source); I've used Perl commercially in a variety of UNIX-based environments (Linux, Solaris, FreeBSD and others); I have substantial Perl experience (over 15 years).

-- Ken

m wondering if there

Replies are listed 'Best First'.
Re: Are there any major Perl issues with Mac OS X Lion?
by DrHyde (Prior) on Sep 06, 2011 at 09:31 UTC

    I've not yet used Lion, but in all previous versions of OS X ... yes, you need to install the dev tools; there are no issues with the CPAN toolchain or with the vast majority of modules (you say you're coming from Windows, so while you will still run into some non-portable code, you will have fewer problems on OS X than you're used to); obviously most stuff with a platform-specific namespace won't work; in general you can assume that it's a normal Unixy system.

    Some Mac::* stuff is for the obsolete pre-OS X rubbish, but it's normally obvious from the docs which is which. That said, I doubt you'll ever need to use any Mac::* stuff directly. I certainly haven't.

      Thanks, DrHyde. Overall, that's fairly reassuring. I started to have a read through the Mac::* modules on CPAN this afternoon: I've never used a Win32:: module to date so, as you say, I probably won't need to use a Mac:: module either.

      -- Ken

Re: Are there any major Perl issues with Mac OS X Lion?
by FunkyMonk (Canon) on Sep 06, 2011 at 10:26 UTC

      Thanks for the links, FunkyMonk. Via the perlport link, I found an HTML version of the README.macosx (POD source) on Perldoc: perlmacosx.

      -- Ken

Re: Are there any major Perl issues with Mac OS X Lion?
by sundialsvc4 (Abbot) on Sep 06, 2011 at 17:32 UTC

    Yes, the Lion OS does advance the installed Perl version, as is to be expected.

    What I do is this:   if the installed Perl is not acceptable to me, or if I need more than one version for testing purposes or what-have-you, I install them from-source into /usr/local/bin and make sure that the desired $PATH is set up in my .bash_profile.   Just as with any ordinary Unix or Linux.   Point being, I never touch the actual version that comes with any operating-system, because I don’t want to screw-up any system tools, vendor-provided updates and so on, “Lion or not, Mac or not.”

    As for CPAN et al, it is strictly “same song, next verse.”   I apply all of the techniques used for “installing Perl as a non-root user” to set up my own private PERL5LIB-referenced directory into which all of “my” CPAN modules and/or module-versions are installed.   I set up my own (non administrative) “software maintenance” account, which, being an ex-VMer, I usually call maint.   This is the user with read/write access to the directory in which I do the CPAN work (as well as /usr/local/bin), and it is the account that actually does all of it.   (By design, it is not an Administrative user and has no special power, but it is the sole owner of all these things and it is the only one, other than root of course, who can affect them.)

    When you do it this way, it no longer matters if you are running Lion or not, and you don’t have to worry about things breaking when you do upgrade the OS.   As I said, I do this for OS/X, for any Unix, and for any Linux.   I just pretend that my computer is a shared-hosting web server someplace (else), and do what I would (be obliged to) do there.

    I have elected to wait to install Lion until shortly after Christmas.   “Computer software like fine wine ... let it age.”   This would not, however, dissuade me from purchasing a Macintosh with that OS installed upon it right now, if I deemed that I needed such a machine right now.

    With regard to your questions about Win32:: and so-forth, Perl does know what kind of operating system it is running on.   (Try perl -V with a capital “V.”)   CPAN module installers will use this information to keep you from doing anything meaningless ... like installing Win32-specific support on a non-Win32 machine like a Mac, or AS400 specific modules on a non-AS400, and so on and on.   Perl is engineered from the ground up to recognize multiple operating environments, and most ... :-D ... of the time it Does The Right Thing.™   It’s entirely up to your own good engineering judgment how platform-specific you wish to be.   Platform-specific modules are more finely tailored to the needs of a particular platform and give-up portability altogether.   During your project engineering sessions, (of course) prior to implementation, you must make your own decision.

      Thanks for the Perl installation details, sundialsvc4. I would generally agree with your let it age policy; however, Lion seems to be the OS I'll get with the new hardware - perhaps I'll need a few updates as it matures. Win32:: was intended to be an example of something I didn't expect to work: while I know it's not the case, if Tk:: modules, for instance, weren't going to work then that would be something I'd like to know up front (more of a platform-exclusion than a platform-specific question).

      -- Ken

      Hi sundialsvc4 : it's been a few months but I wonder if you can help please? I want to use my own version of perl on Snow Leopard, so that CPAN etc. don't interfere with the pre-installed perl. (I've been using and CPANing the sys version over the last 4 years w/o incident, but I'd prefer to have my own perl to be on the safe side.) I downloaded and compiled perl 5.14 and that looks ok using it from batch - I just set my $PATH to see it first. However, I've been unable to get user _www to run cgi using the new version. I've tried editing apache's plist and/or setting up a plist in /Library/WebServer (which according to dscl is _www's home dir), restarting apache, restarting the whole machine. I've put a line in my cgi code to output $^V and it still says 5.10 (sys version which came with SL.) I've also Don't know if you could suggest anthing pls? TIA, Terry
        Hi sundialsvc4 - hmm, the perl version can be changed by changing the shebang, to e.g. /usr/local/bin/perl - I was hoping for a way to override that, or I'll have to change it when I check stuff out then remember to change it back before I check stuff in (live server is linux). So it could be just a nuisance, not a show stopper. Thanks, Terry.
Re: Are there any major Perl issues with Mac OS X Lion?
by luis.roca (Deacon) on Sep 06, 2011 at 14:14 UTC

    Looking at Apple's current offerings, I expect to be purchasing a Mac Pro with OS X Lion. I have no experience with Mac OS X (see Background below for other details).

    Based on you're background, I think you'll be fine (FreeBSD, Solaris etc.). Open up Terminal(command line), drop it in to your dock for quick access and type away.

    In order to build perl/modules, it seems I need to first install Developer Tools (following advice found in Installing make on mac LION osx). Anything else?

    You can work with the system Perl but it's generally recommended to install a separate version for your own work. In the past version both5.8 and5.10 were installed and there were issues with some people due to support for both64 and32bit for example. Those AFAIK are no longer a problem but you are still using the system's Perl. It does use it and if you mess around enough- you won't be happy. If Xcode get's an update that makes a change to the Unix tools that mess with the @INC path, you wont be happy. So, again, you may want to install an alternate version from Activestate.

    That said I never had any significant problems. If you don't plan on using Xcode for anything other than a compiler and your modules are installing fine you can always skip the updates.

    You will also want to install Macports. There are a number of Unix tools and libraries that are not included on the Mac. I don't know what field you're in or interests are but for example, there are some graphics and GUI libraries that are not included. It's pretty straightforward to use Macports but will be an extra step.

    "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote

      Thanks, luis.roca. I'll follow your recommendation on installing my own version of Perl. Yes, it looks like there's quite a few items I'd like from MacPorts - the documentation looks fairly comprehensive as well.

      -- Ken

Re: Are there any major Perl issues with Mac OS X Lion?
by webfiend (Vicar) on Sep 06, 2011 at 21:24 UTC

    The only additional advice I have to offer is to use Perlbrew for managing your personal Perls once you have Developer Tools installed. I've gotten into a habit of not trusting system Perl on any machine. This habit has served me well, and Perlbrew gives me fine-grained control over which version of Perl to run for a given project.

    If you're curious about OSX-specific libraries, Cocoa is most likely to be the magic CPAN word. I have not tried any of these myself, since most of my Perl time is command line and Web.

      I second the recommendation of perlbrew. It makes it very easy to switch between different versions of perl, and avoiding the system perl is always good idea - especially if you want to install cpan modules.

      For example, in order to get Padre ( running on Mac OS X Snow Leopard I needed to install a 32-bit perl (perhaps 64-bit will work OK in the future). Perlbrew combined with the instructions found at made it fairly painless.

      Thanks, webfiend. The Perlbrew concept looks interesting - I'll investigate this further. Yes, the magic word Cocoa has been popping up quite a bit in my recent reading - thanks for the MetaCPAN link.

      -- Ken

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://924320]
Approved by BrowserUk
Front-paged by chrestomanci
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2017-01-20 04:57 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (173 votes). Check out past polls.