Library not loaded:libmysqlclient.16.dylib错误,当试图在OS X 10.6上使用mysql2 gem运行'rails server'时 [英] Library not loaded: libmysqlclient.16.dylib error when trying to run 'rails server' on OS X 10.6 with mysql2 gem

查看:143
本文介绍了Library not loaded:libmysqlclient.16.dylib错误,当试图在OS X 10.6上使用mysql2 gem运行'rails server'时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为此付出一些努力。



我在Snow Leopard机器上安装了Rails 3,gem,mysql。直到我创建了第一个项目并试图运行

  rails server 



$ b


$ b $ p $ jontybrook $ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6 /lib/mysql2/mysql2.bundle,9):未加载库:libmysqlclient.16.dylib(LoadError)
引用自:/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/ mysql2 / mysql2.bundle
原因:image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle $ b $ from / Library / Ruby / Gems /1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:在`require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in`require'
from / Library / Ruby / Gems / 1.8 / gems / bundler-1.0.7 / lib / bundler / runtime.rb:62:在`每个'
from / Library / Ru由/ Gems / 1.8 / gems / bundler-1.0.7 / lib / bundler / runtime.rb:62:在'require'
从/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/ lib / bundler / runtime.rb:51:在'each'中
从/Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in'require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in`require'
from / Users / jontybrook / Dropbox / CODING / simple_cms / config / application.rb:7 / bibrary/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in中的
从/ Library中'require'
/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28 $ / bibrary/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/ commands.rb:27:在`tap'中
从/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
from script / rails: 6:在'require'
脚本/ rails中:6
jontybrook $

据我可以告诉问题是与MySQL2宝石。 MySQL似乎运行良好,我的Gemfile引用了mysql2,我的database.yml文件似乎也没问题。



错误提及

 原因:image not found  -  /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle 

但是

  jontybrook $ cd /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2 
jontybrook $ ls
client.rb em.rb error.rb mysql2.bundle result.rb

MySQL2.bundle is there!?



如果我使用旧的MySQL的宝石,WEBrick靴子罚款。但这并不理想,是吗?



我已经试过谷歌可以给我的所有东西!任何帮助我们都非常感谢。

解决方案

我从来没有能够得到任何这些答案为我工作,但这是命令我曾经让它为我工作。这样,每次更新mysql时就不需要使用install_name_tool。

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


I've been struggling with this for some time.

I've installed Rails 3, gem, mysql on my Snow Leopard machine. All was going well until I created my first project and tried to run

rails server

Upon running this I get:

jontybrook$ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
    from /Users/jontybrook/Dropbox/CODING/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6
jontybrook$ 

As far as I can tell the problem is with the mysql2 gem. MySQL seems to be running fine and my Gemfile references mysql2, my database.yml file seems ok also.

The error mentions

Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

And yet

jontybrook$ cd /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2
jontybrook$ ls
client.rb   em.rb       error.rb      mysql2.bundle result.rb

MySQL2.bundle is there!?

If I use the old mysql gem, WEBrick boots fine. But that's not ideal, is it?

I've tried everything google can give me! Any help much appreciated.

解决方案

I was never able to get any of these answers to work for me, but this is the command that I used to make it work for me. This way you don't need to use install_name_tool every time you update your mysql

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

这篇关于Library not loaded:libmysqlclient.16.dylib错误,当试图在OS X 10.6上使用mysql2 gem运行'rails server'时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆