Installing DBD::mysql on Mavericks

3 years ago, I posted about getting DBD::mysql to build on OSX 10.6 – it seems the same thing works on Mavericks (10.9) as well!

#   Failed test 'use DBD::mysql;'
#   at t/00base.t line 18.
#     Tried to use 'DBD::mysql'.
#     Error:  Can't load '/Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /Users/simon/.cpan/build/DBD-mysql-4.027-wbgMWL/blib/arch/auto/DBD/mysql/mysql.bundle
#   Reason: image not found at /System/Library/Perl/5.16/darwin-thread-multi-2level/DynaLoader.pm line 194.
#  at (eval 7) line 2.

The version of MySQL has changed slightly (and hence the path used) but everything else is the same.

$ sudo install_name_tool -id /usr/local/mysql-5.5.30-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.30-osx10.6-x86_64/lib/libmysqlclient.18.dylib

$ otool -D `mdfind libmysqlclient.18.dylib`

DBD::mysql, MySQL and OS X Lion

I downloaded and installed MySQL Community Server 5.5.15 from http://dev.mysql.com/downloads/mysql/5.5.html

Using CPAN, I then tried to install DBD::mysql on a fresh install of OS X Lion and was presented with an error saying it was unable to load the library.

#     Error:  Can’t load ‘/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle’ for module DBD::mysql: dlopen(/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle

Continue reading