1
rake aborted!
dlopen(/Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib
  Referenced from: /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/ava/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle`

运行以下解决方案:

$ sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib \
             /usr/lib/libmysqlclient.18.dylib
ln: /usr/lib/libmysqlclient.18.dylib: File exists

我的设置:

  • OSX 10.8.4
  • MySQL 5.1.71
  • libmysqlclient.16.dylib

    $ locate libmysqlclient.16.dylib
    /usr/lib/libmysqlclient.16.dylib
    /usr/local/Cellar/mysql51/5.1.71/lib/mysql/libmysqlclient.16.dylib
    
  • libmysqlclient.18.dylib

    $ locate libmysqlclient.18.dylib
    /usr/lib/libmysqlclient.18.dylib
    

.bash_profile,我有

export PATH="/usr/local/bin:$HOME/.rvm/bin:$HOME/bin:$PATH"
export DYLD_LIBRARY_PATH=/usr/local/bin/mysql

如何让这个耙子运行?我也应该libmysqlclient.18.dylib/usr/local/Cellar/mysql51/5.1.71/lib/mysql吗?如果是,我该如何创建它?

4

2 回答 2

2

对不起,如果我弄错了;没有 Mac 可以查看详细信息。

错误消息清楚地指出,图书馆mysql想要的是:

/usr/local/lib/libmysqlclient.18.dylib

而您拥有的图书馆是:

/usr/lib/libmysqlclient.18.dylib

这绝对意味着,您的mysql安装以某种方式损坏,但对于快速补丁,我建议使用软链接:

$ sudo ln -s /usr/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

您可能在第一次尝试解决方案时放错了论点。

于 2013-08-27T12:21:24.290 回答
0

如果您使用的是 Bash,请指示 Mac OS X 按如下方式找到它:

在你的~/.bash_profile

export DYLD_LIBRARY_PATH=<location of mysqlclient.18.dylib>:$DYLD_LIBRARY_PATH

重启终端。

例如,我有以下内容:

$ ls -ld /usr/local/m*
lrwxr-xr-x   1 root  admin   27 May  5 14:28 /usr/local/mysql -> mysql-5.6.13-osx10.7-x86_64
drwxr-xr-x   3 root  wheel  102 May  5 13:13 /usr/local/mysql-5.5.29-osx10.6-x86
drwxr-xr-x  17 root  wheel  578 May  5 13:13 /usr/local/mysql-5.6.13-osx10.7-x86_64

$ head ~/.bash_profile
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
于 2014-05-05T21:46:13.313 回答