Installing DBD::Pg and DBD::mysql on Mac OSX (Snow Leopard)

I went through a lot initially trying to get perl to be able to interface to mysql and postgres on Mac OSX. My steps weren't optimal, and I wouldn't recommend them for anyone.

However, after purchasing my Mac Book Pro, I had to go through the process again, but this time, it was much more refined. So in essence, it boils down to this:

  1. Make sure you have your flavor of mysql or postgresql installed AND PAY ATTENTION TO WHETHER IT SHOULD BE A 32 BIT BUILD OR A 64 BIT BUILD. If you are on a modern mac, chances are you're going to be using a 64 bit build of either of these.
  2. wget the latest DBD::Pg or DBD::mysql driver from CPAN. You're going to have to manually build these with the libs and flags your mysql was built with. The easiest way to obtain these flags via mysql_config --cflags and --libs (respective config for pg too). Then, run perl Makfile.PL with --cflags and --libs set with the appropriate settings
  3. Make sure mysql/pg are actually running! Your tests will fail otherwise.

This is brief, hurried, and probably not nearly as comprehensive as others. But, it should give you a relatively intuitive overview of how to get it going on your shiny mac.

Please let me know if I've left anything out!

No TrackBacks

TrackBack URL: http://www.catalyzed.org/mt/mt-tb.fcgi/74

3 Comments

| Leave a comment

Hi,

I'm using http://www.postgresqlformac.com/ and had no problems installing DBD::Pg from the cpan shell. I don't use MySQL, so not sure about that.

user-pic

Hi Devin,

basically it is this simple. My personal way to install PostgreSQL is using Macports. [http://www.macports.org]. Having this tool installed I simply get PostgreSQL by:

# port install postgresql84-server

# export POSTGRES_HOME=/opt/local/lib/postgresql84/

# cpan DBD::Pg

As an alternative, you also could use Macport's perl (which does not have the "unknown error bug") and use the macports-provided perl modules.

Thanks Mo and Wolfgang!

Sorry for the late reply, I'm a bit of a lout lately.

Anyway, thanks for the links. Glad to see DBD::Pg is even easier to install than I had previously thought.

Leave a comment

All comments are moderated. Spammers don't waste your time

Sponsored By


Ionzero: Rescue your dev project.

Following

Not following anyone

Note to spammers: all comments are moderated. Don't waste your time