问题
I just upgraded to Mac OSX Snow Leopard, and recompiled mysql (5.1.39) with the Snow Leopard XCode. I also reinstalled the latest mysql gem.
Now, when running
rake db:migrate
in a rails app, I get
dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found
Trace/BPT trap
I have /usr/local/mysql/lib/libmysqlclient.16.dylib, but not ...15.dylib.
Do I need to use an earlier version of mysql?
回答1:
No it almost looks like you need to remove the mysql gem and then re-install it using gem install mysql -- --with-mysql-dir=/path/to/mysql_dir (sometimes /usr/local/mysql)
回答2:
Try hammering in which version of mysql for the gem to use:
gem install mysql -- --with-mysql-config=/path/to/mysql_config
回答3:
Thanks for the help!
I ended up removing mysql completely:
http://akrabat.com/2008/09/11/uninstalling-mysql-on-mac-os-x-leopard/
Then compiling and installing the following to /usr/local:
readline 6.0 ruby 1.8.7 rubygems
With help from
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard
来源:https://stackoverflow.com/questions/1677588/mysql-gem-looking-for-an-earlier-version-of-libmysqlclient-16-dylib