简体   繁体   中英

Issue when trying to run WEBrick and Rails

Going through the Lynda training for Ruby on Rails and got to the point where I am starting the WEBrick sever via the rails s command. I am in the same directory as the video /Users/myuser/Sites/simple_cms

I get the following error:

/usr/local/lib/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/usr/local/lib/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
    from /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.3.2/lib/mysql2.rb:8
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
    from /Users/myuser/Sites/simple_cms/config/application.rb:7
    from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
    from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

I followed the instructions @ Unable to start rails server
Still getting the error. I also followed the directions @ rails server fails to start with mysql2 using rvm & ruby 1.9.2-p0 on OSX 10.6.5
Any help would be appreciated.

Okay so after further research I found my own answer

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

This did it for me. Just incase anyone else can't move past this problem with the original solutions.
Source: http://samuel.kadolph.com/2011/04/mysql2-gem-and-mac-os-x-image-not-found/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM