Problem launching WEBrick in Rails

5 views
Skip to first unread message

David D.

unread,
Jun 20, 2011, 9:41:31 PM6/20/11
to Ruby on Rails: Talk
Hey everyone, i'm super new to Rails and excited to get going! I'm
following the Ruby on Rails Essentials 3 tutorial from Lynda very
closely and came across an error at the step when launching WEBrick.

MY Setup:
I am on OS X. I have installed the MySQL client and ran it from my OS
X system prefs. I double checked my gems and mysql (2.8.1) and mysql2
(0.3.6, 0.2.11) are BOTH listed in my local gems list in terminal. I
can launch MySQL in terminal as well.

Problem:
So, the issue is that when launching WEBrick via the 'davidd$ rails
server' command I get:

davidd$ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle:
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/
mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
(LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/
mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/
lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/
runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:120:in
`require'
from /Users/daviddiliberto/Sites/simple_cms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:
28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:
28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:
27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:
27
from script/rails:6:in `require'
from script/rails:6

Any cause for this? Is there any way I can remove the mysql gems and
try re-installing them? Thanks so much for any help you guys may have!

DD

Chirag Singhal

unread,
Jun 21, 2011, 8:07:11 AM6/21/11
to rubyonra...@googlegroups.com
Hopefully you may have solved the issue by now, if not, this is what you can do on your mac

# On Mac OS X:
#   sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
# On Mac OS X Leopard:
#   sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
#       This sets the ARCHFLAGS environment variable to your native architecture

This is from the config/database.yml file

To uninstalling previous version of gem may not be required, but you can uninstall it using:
sudo gem uninstall mysql

Ritesh Kumar

unread,
Aug 2, 2011, 1:59:39 PM8/2/11
to rubyonra...@googlegroups.com
Create a soft link by command -
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib
/usr/lib/libmysqlclient.18.dylib


http://rorguide.blogspot.com/2011/07/getting-error-library-not-loaded.html

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages