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 thoughts on “Using MacPorts to Install CPAN Modules Not Included in the Ports System

Leave a Reply

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