Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 594
westlywright Avatar asked Nov 28 '25 07:11

westlywright


1 Answers

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/

like image 118
westlywright Avatar answered Nov 29 '25 19:11

westlywright