Monday, April 27, 2009

Installing perl modules in OSX

This should not have been hard but it ended up being a big pain for me so I thought I would document the process for installing a perl module on Mac OSX. It ended up being tricky because there were two ways I found to do it. I will first list the way I ended up NOT using.
  1. Install Xcode - this is required for installing and running darwin ports (a.k.a macports)
    This is a disk image with a binary installer which is about 900 MBs in size and takes a few minutes to install, it also requires an apple developer connection membership before you can download it
  2. Install DarwinPorts - this is required for installing yum
    Download the disk image and run the binary installer, you have to fill in your name and email address to download
    Run this command as root once you finish running the installer:
    sudo port -d selfupdate
  3. Install Yum - this is required to install the perl module
    Run this command (takes a long long time) to as root to cause darwin ports to install yum:
    sudo port install yum
  4. Use yum to install the perl module
    yum -y install perl-Frontier-RPC
After doing all this and facing failure I searched around more and found the instructions here:
For the same module (Frontier) the commands ended up being (after installing Xcode, much like linux):
sudo su
perl -MCPAN -e shell
install Frontier::Client
This worked out a lot better for me (though the process took about 15 minutes total). Make sure you run this as root since it will produce lots of fun failures otherwise.

1 comment:

Steve Swinsburg said...

CPAN all the way. Grabs all the dependencies for you as well.

It's like the Maven of Perl!