I recently tried to install the mysql gem for ruby 1.9.1 on my macbook (OSX 10.5.6). I started with the 'usual' command to install the (modified) mysql gem:
$ sudo gem19 install kwatch-mysql-ruby --source=http://gems.github.com/ -- --with-mysql-config=mysql_config
The gem was compiled and installed correctly, but I got the following error when requiring 'mysql':
LoadError: dlopen(/usr/local/lib/ruby19/gems/1.9.1/gems/kwatch-mysql-ruby-2.8.1/lib/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby19/gems/1.9.1/gems/kwatch-mysql-ruby-2.8.1/lib/mysql.bundle
Reason: image not found - /usr/local/lib/ruby19/gems/1.9.1/gems/kwatch-mysql-ruby-2.8.1/lib/mysql.bundle
The problem is that the mysql gem tries to load libmysqlclient.dylib from the wrong directory. The following command resolved the problem:
$ sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby19/gems/1.9.1/gems/kwatch-mysql-ruby-2.8.1/lib/mysql.bundle
the first param ist the incorrect path which is used by the mysql.bundle, the second param is the correct path to be used instead and the third param is the path to the mysql.bundle. Adapt the params to your needs.
Wednesday, April 1, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment