ruby on rails mac x os lion run server LoadError
When I type the rails server on terminal, I got the following error. I don't know how to fix it. Is any one can give me a help? And I also need a ruby on rails mac os x Lion installation tutorial.
:simple_cms benhuayang$ rails server /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': dlopen(/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle Reason: image not found - /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' from /Users/benhuayang/Sites/simple_cms/config/application.rb:7:in `<top (required)>' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:53:in `block in ' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap' from /Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'
this is path for mysql
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/bin:/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0@global/bin:/Users/benhuayang/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/benhuayang/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
When I've run into this in the past, I've used the following solution.
In the terminal, run:
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib"
Then try running your rails server
command in the root of your app. If it works, just put that same command into your ~/.profile so that it runs each time you enter the terminal.
Ryan的解决方案适用于我在运行rake db后出现以下错误:migrate,我认为它会帮助Google搜索。
rake aborted!
dlopen(/Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
(See full trace by running task with --trace)
链接地址: http://www.djcxy.com/p/38760.html