开发者

Issues with Rails gem mysql2 on OS X 10.7 with Ruby 1.9.2 and Rails 3.1

OS Version: Mac OS X 10.7.1 Lion

Ruby Version: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]

Ruby Location: /usr/local/rvm/bin/ruby

Rails Version: Rails 3.1.0

Rails Location: /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails

Now, I installed the mysql2 gem and when I run gem list it shows up in the list as: mysql2 (0.3.7)

So far so good, right? OK, so here's where it gets tricky. No matter what I do, I can't start the server. In terminal I cd to the directory my rails app is and run rails s. However, instead of starting i get this:

/usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `require': dlopen(/usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
  Reason: image not found - /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2.rb:9:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
    from /Users/doug/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:52:in `block in <top (required)>'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
    from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Obviously, this is not what should be happening. The problem is I ca开发者_高级运维n't figure out why not. None of the solutions I've come across have worked.

This is actually my first attempt at getting Ruby/RoR working on my computer. I'm following a tutorial from Lynda.com and, unsurprisingly, this doesn't happen to the guy doing the videos.

I've tried searching and, as I said, nothing seems to help. Ideas?


install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.2-p290@[gemset name]/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle

[gemset name] = the name of the gemset you are using -- if you didn't set one then you should set it as that is one of the main points of getting rvm

hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜