carlriz has asked for the wisdom of the Perl Monks concerning the following question:

I am installing DBI onto my system. So, far I have issued the command: sudo perl -MCPAN -e 'install DBD::mysql'. For hardware, I am running macbook pro 10.8.4 OS X.

Then it looks like it runs a 'make test', which ends up failing because it cannot find certain dependencies.

Can't exec "mysql_config": No such file or directory at Makefile.PL li +ne 70. Cannot find the file 'mysql_config'! Your execution PATH doesn't seem not contain the path to mysql_config. Resorting to guessed values! Can't exec "mysql_config": No such file or directory at Makefile.PL li +ne 473. Can't find mysql_config. Use --mysql_config option to specify where my +sql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL li +ne 473. Can't find mysql_config. Use --mysql_config option to specify where my +sql_config is located Can't exec "mysql_config": No such file or directory at Makefile.PL li +ne 473. Can't find mysql_config. Use --mysql_config option to specify where my +sql_config is located

Where do I get this config file? Is there anything else that I am missing?

Replies are listed 'Best First'.
Re: DBI Installation Mac
by kcott (Archbishop) on Mar 31, 2014 at 14:55 UTC

    G'day carlriz,

    When you have problems installing any module, you should look for README and INSTALL files. These will generally tell about dependencies, prerequisites, and anything else important for installation.

    Here's how to do it for DBD::mysql. (The process is much the same for any Perl module.)

    1. Go to the CPAN documentation for your module. Near the top is a link to the distribution page which looks like "Module-Name-version.number". For the current version of DBD::mysql (at the time of writing) this is DBD-mysql-4.027. Follow this link.
    2. On the distribution page, you'll find links to a variety of resources. In this instance, follow the README.pod link.
    3. On the README page, you'll find a variety of information. In this instance, you'll see a link to DBD::mysql::INSTALL. Follow it.
    4. Now you'll see lots of installation information. There's an answer to the question you've posed here. There's a Mac OS X section that will be important for you. There's a lot of other information which may be useful to you. I suggest you spend some time looking through this document.

    -- Ken

Re: DBI Installation Mac
by frozenwithjoy (Priest) on Mar 31, 2014 at 15:01 UTC

    First, I want to just check the obvious: MySQL is installed, right?

    I've encountered this same error, but it was on a Linux machine. I followed this guy's advice and installed libmysqlclient-dev via aptitude.

    There is a post on SO about installing this library on OS X. The most popular answer was installing MySQL with Homebrew: brew install mysql. Even if your computer came pre-installed with MySQL, it might be good to use a brewed version so you can re-install or update w/o breaking anything your system needs.

      Yes, I have installed the module. The only issue I have is how to get the mysql_config file into my execution path... This is where I am at now: http://search.cpan.org/~capttofu/DBD-mysql-4.027/lib/DBD/mysql/INSTALL.pod#Mac_OS_X

        Hi. What exactly do you mean when you say "I have installed the module"? Which module are you referring to? Can you confirm that MySQL is installed on your machine by typing mysql in Terminal? Thanks.