mysql gem not working on Leopard
I keep getting this error when including
require "mysql"
in my programs
/Library/Ruby/Site/1.8/universal-darwin9.0/mysql.bundle: dlopen(/Library/Ruby/Site/1.8/universal-darwin9.0/mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (LoadError)
Referenced from: /Library/Ruby/Site/1.8/universal-darwin9.0/mysql.bundle
Reason: image not found - /Library/Ruby/Site/1.8/universal-darwin9.0/mysql.bundle
from connect.rb:13
and I've noticed that this library isn't actually there... This is what I get when I list the directory
3536 libmysqlclient.18.dylib* 4 libmysqlclient_r.dylib@
8660 libmysqlclient.a 53888 libmysqld-debug.a
4 libmysqlclient.dylib@ 50496 libmysqld.a
4 libmysqlclient_r.18.dylib@ 8 libmysqlservices.a
4 libmysqlclient_r.a@ 0 plugin/
I am trying to install it with the following command, but it still doesn't work:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
> --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
> --with-mysql-include=/usr/local/mysql/include
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No开发者_如何学编程 definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
I had exactly the same problem. I never found an answer. After hours of headaches I finally installed MacPorts.
It's super easy to use
It intalls everything in a clean, separated folder, so you can always fall back on the default Apple version.
It's quite up to date (it includes ruby 1.9)
精彩评论