rails server fails to start with mysql2 using rvm & ruby 1.9.2-p0 on OSX 10.6.5
Posted
by
Scott
on Stack Overflow
See other posts from Stack Overflow
or by Scott
Published on 2010-12-22T18:26:40Z
Indexed on
2010/12/23
23:54 UTC
Read the original article
Hit count: 436
I'm getting the following error when I start rails server:
$ rails server
/Users/ssmith/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `require': dlopen(/Users/ssmith/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
Referenced from: /Users/ssmith/.rvm/gems/ruby-1.9.2-p0/gems/mysql2- 0.2.6/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/ssmith/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-
0.2.6/lib/mysql2/mysql2.bundle
I've installed mysql2 with the following command after the rvm use ruby-1.9.2-p0 command:
$ gem install mysql2 -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql2-0.2.6
1 gem installed
Installing ri documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
I have mysql2 in my Gemfile as well as in the database.yml file and bundle install completes fine
$ bundle show mysql2
/Users/ssmith/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6
I understand the rails server error is due to it not knowing the mysql_config location on OSX, however on gem install I specified the correct location. Yet RVM's gem is not respecting that mysql_config location it seems.
Anyone have a solution to this?
Thanks in advance.
Scott
© Stack Overflow or respective owner