Mac OS X

Perl Control

There are a lot of versions of the popular perl scripting language out there, and depending on what version you may have written a script with you might find that using a different version than the one that comes with an OS by default can have a drastic impact on a script. In Mac OS X you can change the default version of perl that the perl and a2p command will use. Before doing so you should check the version of perl being used by default, which can be done using the perl command, followed by the -v option:

perl -v

By default, the OS currently uses version 5.10.0. To change the version, you would use the defaults command to change the com.apple.versioner.perl defaults domain. You will add a key called Version with a string of the version you would like to use. For example, to switch to 5.8.8:

defaults write com.apple.versioner.perl Version -string 5.8.8

To change it back to 5.10.0:

defaults write com.apple.versioner.perl Version -string 5.10.0

You can also set perl to run in 32 bit mode:

defaults write com.apple.versioner.perl Prefer-32-Bit -boolean TRUE

To put it back:

defaults write com.apple.versioner.perl Prefer-32-Bit -boolean FALSE

Python provides the same functionality:

defaults write com.apple.versioner.python Version -string 2.6

Or to run Python in 32-bit mode:

defaults write com.apple.versioner.python Prefer-32-Bit -boolean TRUE