Can't start rails server
I know these questions has been answered before but i cant start the rails server that i have set up. Someone posted the exact same error here Unable to start rails server but i cant get it to work with the answer. I'm really new at all this so help would be greatly appreciated.
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ru开发者_运维百科by/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
from /Users/valentin/Sites/simple_cms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
Im running: mySQL: 5.5.11
rails: 3.0.7
ruby:1.8.7
gems: 1.7.2
mySQL2: 0.2.7
Can anyone please help? Thanks!
Neither of the other links were the same problem as yours, both of those problems were with older mysql2
gems that didn't have the full path to libmysqlclient.16.dylib
in the bundle, notice that your error has the full path, Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib
(the other questions did not have that).
Your problem is that that lib probably doesn't exist because that's not where MySQL will be installed in most OSX systems.
Assuming that you've installed MySQL you should have a command called mysql_config
- you want to install your gem by pointing the installer at this file. The installed can then use the output from mysql_config
to find the right place for all the MySQL libs it needs.
Bored and just want the answer?
sudo gem install mysql2 -- --with-mysql-config=`which mysql_config`
精彩评论