开发者

Rails server will not run - is this a mysql2 problem?

开发者 https://www.devze.com 2023-03-15 14:42 出处:网络
Following a tutorial PRECISELY and trying to get rails server to run and getting the following error:

Following a tutorial PRECISELY and trying to get rails server to run and getting the following error:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3.
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
    NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
    Gem::SourceIndex#each called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:84.
    /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
      Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
      Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
        from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9
        from /Library/Ruby/Gems/1.8/gems/bundle开发者_JAVA技巧r-1.0.10/lib/bundler/runtime.rb:68:in `require'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
        from /Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
        from /Users/EricFriedman/Sites/simple_cms/config/application.rb:7
        from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:28:in `require'
        from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:28
        from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:27:in `tap'
        from /Library/Ruby/Gems/1.8/gems/railties-3.0.8/lib/rails/commands.rb:27
        from script/rails:6:in `require'
        from script/rails:6


You need to lock down your version of mysql2 if you are using Rails 3.0.x. In your Gemfile:

gem "mysql2", "~> 0.2.11"

Then run bundle install or bundle update mysql2.

Edit:

I notice you are using the 0.2.11 version of the mysql2 gem.

Looking more closely, I noticed this error:

Library not loaded: libmysqlclient.18.dylib (LoadError)

This may indicate that the mysql development headers/libraries are not available. Your installation the mysql2 gem should have failed when you ran bundle install. If so, you need to install these development libraries and then reinstall the gem.


Library not loaded: libmysqlclient.18.dylib (LoadError)

you need mysql install on your box.

if you type mysql into a terminal what happens?

also

if you type mysql --version into a terminal what happens?


This worked for me:

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

Here is the original post: http://c.kat.pe/post/how-to-fix-mysql-load-issues-on-mac-os-x/

0

精彩评论

暂无评论...
验证码 换一张
取 消