Using MacPorts to Install CPAN Modules Not Included in the Ports System

Super simple instructions to create a Portfile from scratch. In this example, we’ll create one for “WWW::Mechanize::Cached”:

{{{
# Create a directory to store your Portfiles
mkdir ~/MacPorts/
# Change directory
cd ~/MacPorts/
# Get the “cpan2port” script used to create Portfiles
curl http://trac.macports.org/export/69899/contrib/cpan2port/cpan2port > cpan2port
# Set the executable permissions on the script
chmod 755 cpan2port
# Create the Portfile for the “WWW::Mechanize::Cached” module
sudo ./cpan2port -t WWW::Mechanize::Cached;
# Change directory to the new port
cd perl/p5-www-mechanize-cached/
# Build the port (and dependencies)
sudo port build
# Install the port
sudo port install
}}}

2 comments

  1. chimpy says:

    Thank you so much for this. Completely painless and it works perfectly. Thanks!

  2. [...] something only available on CPAN, use cpan2port by following the simple instructions here. Via VN:F [1.9.8_1114]please wait…Rating: 0.0/10 (0 votes [...]

Leave a Reply

Your email address will not be published. Required fields are marked *