Adding Perl support for MySQL on Mac OS X part 3

Now we have MySQL up and running, it’s time for the Perl support. Mac OS X comes with a standard Perl port, without the MySQL support. It is not advisable to add modules to the this built-in port of Perl, it is possible a Mac OS X software update from Apple could temper with the additions. Instead, we will install a completely separate port of Perl, and to this port we will add the MySQL support. First, go to the ActivePerl download page, follow the ‘Download ActivePerl’ link, fill in or skip the form, and download the ‘Mac OS X’ version. Mount the downloaded image, and double-click the installer. This will install the ActivePerl port in the /usr/local directory on your harddisk.

Open a terminal window (I prefer to use iTerm), and type:

cd /usr/local

Give yourself a root-password (choose a good one!):

sudo passwd root

And become root:


Now, type (with your version number of ActivePerl) to create a convenient path to the new Perl:

ln -s ActivePerl-5.8 perl

The new Perl is now available as /usr/local/perl/bin/perl, if you want to use it your file with Perl commands should start with:


Adding MySQL support for this Perl

This new Perl has now been installed, but it is still without the support for MySQL! So finally we will come to the last step in this process. Type in the terminal window:

cd perl/bin

You should now be in the directory with the binaries of ActivePerl. Type:


This will start a nifty utility which will add modules to the ActivePerl port. Type:

install DBI

This should download and install the DBI module. Then type:

install DBD-mysql

This should download and install the DBD-mysql module. Finish with a simple q, and the ‘ppm’ program should quit.

This is it! We now have Perl installed with MySQL support!

Leave a Reply