Skip to content

Mac OS X “Snow Leopard” (10.6) and Perl

January 24, 2010

Snow Leopard ships with multiple versions of Perl:

  • 5.10.0 (64 bit)
  • 5.10.0 (32 bit)
  • 5.8.9 (32 bit)

The default Perl is 5.10.0 (64 bit). However you can change this to 32-bit Perl by setting the following ENV shell variable:

export VERSIONER_PERL_PREFER_32_BIT=yes

And to switch to 5.8.9 all you need is this ENV variable set:

export VERSIONER_PERL_VERSION=5.8.9

Instead of setting these ENV variables in your Terminal sessions you can also make the change to the systems defaults:

  • defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes
  • defaults write com.apple.versioner.perl Version 5.8.9

This is a interesting move by Apple and something which may come in very handy in the future.

As it stands at this moment though you probably want 5.10.1 (and beyond) because of issues with 5.10.0. So you will probably be looking down the compiling route anyway. Still it does give the future option of a local::lib possibility with the pre-installed Perl provided by Apple.

NB. I always recommend that you avoid installing modules with CPAN (shell) on OS provided Perl. Always stick to the OS provided package installer to update Perl & modules (which unfortunately for Mac’s means “zilch” :( Apple “Software Updater” may update Perl itself but no extra modules are provided above what Apple provides on top of core Perl)

/I3az/

References:

About these ads
7 Comments leave one →
  1. jason mazzotta permalink
    June 27, 2010 5:54 pm

    This seems like a really easy quick switch to make, but this doesn’t seem to work for me. I look at /usr/bin/perl, do an `ls -l` and `file` on it and get:

    -rwxr-xr-x 1 root wheel 86000 Jun 24 2009 perl

    perl: Mach-O universal binary with 3 architectures
    perl (for architecture x86_64): Mach-O 64-bit executable x86_64
    perl (for architecture i386): Mach-O executable i386
    perl (for architecture ppc7400): Mach-O executable ppc

    if I do an `ls -l` and `file` on per5.10.0, I get:

    -rwxr-xr-x 1 root wheel 51200 Jun 24 2009 perl5.10.0

    perl5.10.0: Mach-O universal binary with 3 architectures
    perl5.10.0 (for architecture x86_64): Mach-O 64-bit executable x86_64
    perl5.10.0 (for architecture i386): Mach-O executable i386
    perl5.10.0 (for architecture ppc7400): Mach-O executable ppc

    So, they appear to be compiled in the same way, but their not the same file. If I simply move perl to perl.old and symbolically link perl5.8.9 to perl, I don’t get errors when I try to build the DBD::mysql PERL module.

  2. June 29, 2010 9:47 am

    Hi Jason,

    Doing `strings` on each perl binary file does provide a bit more info. I think the /usr/bin/perl is not the perl VM but an Apple version switcher executable. In fact its not even clear that /usr/bin/perl5.8.9 and /usr/bin/perl5.10.0 are VM’s but instead also just wrappers.

    So running /usr/bin/perl5.10.0 will probably always run 5.10.0 but it still also checks the VERSIONER_PERL_PREFER_32_BIT env variable.

    BTW: If you building CPAN module directly with Apple’s Perl then you may have trouble switching between versions (especially worrying would be 32bit to 64bit). No idea if Apple has catered for this?

    /I3az/

  3. July 1, 2011 7:14 pm

    THANK YOU THNAK YUO TANHK YOU !@#!#!!!#!#!!!

    Upgrade to 10.6 was a downgrade for Perl, specifically GD image generation.

    Clearly a 32 versus 64 problem and improper install of 10.6.

    But, I did not know where to fix it, and HOW SIMPLE WAS THIS!

    THANK YOU.
    Rev John.

Trackbacks

  1. Mac OS X “Snow Leopard” (10.6) and Perl « Chicago Mac/PC Support
  2. Tweets that mention Mac OS X “Snow Leopard” (10.6) and Perl « transfixed but not dead! -- Topsy.com
  3. Perl and Mac OS X versions « transfixed but not dead!
  4. Installing DBD::mysql with MAMP | BlockQuote

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: