I have an error while trying to 'bundle install' when listing 'mysql2' on the Gemfile on OSX Lion. I'm currenly building an app with Rails. If I run 'bundle install', it hangs forever. First I tried to fix the issue by modifying the gem file to 'gem 'mysql2', :git => 'git://github.com/sodabrew/mysql2.git', :ref => 'a2800f'', as suggested here: https://github.com/brianmario/mysql2/pull/654. The infinite loop got fixed, I ran 'bundle install' sucessfully but when I run 'rake db:create', I got this error:
rake aborted!
LoadError: dlopen(/Users/macbook/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/mysql2-a2800f86754b/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib
Referenced from: /Users/macbook/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/mysql2-a2800f86754b/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/macbook/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/mysql2-a2800f86754b/lib/mysql2/mysql2.bundle
/Users/macbook/Desktop/tutorial/billingleap2/moviestore/config/application.rb:7:in `<top (required)>'
/Users/macbook/Desktop/tutorial/billingleap2/moviestore/Rakefile:4:in `<top (required)>'
I also try to 'brew install mysql' and it worked, but then on 'rake db:create', I got this error:
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"moviestore_development"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
#<Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8","pool"=>5, "username"=>"root", "password"=>nil, "host"=>"localhost", "database"=>"moviestore_test"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
So then I 'brew uninstall mysql' and that problem was gone, but now I have the first one.
Trying 'gem install mysql2 -v '0.3.19'' also hangs.
What could be the problem?