开发者社区> 问答> 正文

未加载库:尝试在具有MySQL2的OS X 10.6上运行“ Rails服务器”时,libmysql

我已经为此苦苦挣扎了一段时间。

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

rails server 运行后,我得到:

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:inrequire' 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:inrequire' 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:inrequire' 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:inrequire' 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:inrequire' from script/rails:6 jontybrook$ 据我所知,问题出在mysql2 gem。MySQL似乎运行良好,我的Gemfile引用了mysql2,我的database.yml文件似乎也不错。

错误提到

Reason: 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在那里!?

如果我使用旧的mysql gem,则WEBrick可以正常启动。但这不是理想的,是吗?

我已经尝试了Google可以给我的一切!任何帮助,不胜感激。

展开
收起
保持可爱mmm 2020-05-10 19:45:49 632 0
1 条回答
写回答
取消 提交回答
  • 我从来没有得到任何这些答案可以为我工作,但这是我用来使其工作的命令。这样,您不需要在每次更新mysql时都使用install_name_tool

    sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib 分享来源:stack overflow

    2020-05-10 19:46:01
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
国产服务器操作系统发展报告(2023年) 立即下载
开放算力·云启未来 立即下载
2022龙蜥操作系统生态用户实践精选 立即下载