1

Trying to get a Rails app running on Snow Leopard.

  • Downloaded mysql-5.5.8-osx10.6-x86_64.dmg and ran installer
  • Ruby 1.8.7 (Default OS X version)
  • Rails 2.3.5

When I attempt to run "rake db:migrate" I get

  • rake aborted!
  • uninitialized constant MysqlCompat::MysqlRes

Yes I know this has been asked before. I have already reviewed the following links and followed the steps included in them and the result is the same each time.

Prior to the following commands I run "sudo gem uninstall mysql" followed by "sudo gem clean mysql" based on the above links:

  • sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
  • sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

It is still failing. I am just flumoxed and would greatly appreciate any help.

Many thanks!

Community
  • 1
  • 1
Mr. Wobbet
  • 65
  • 1
  • 10

2 Answers2

3

Not had the experience myself and I'm using Snow Leopard, RVM and rails 2.3.5 to 3.0.3, but found another view which deals with the uninstall and reinstall via :

export ARCHFLAGS="-arch i386 -arch x86_64" ;sudo gem install --no-rdoc --no-ri -v=2.7 mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

For more details see the posting at: http://accidentaltechnologist.com/apple/fixing-uninitialized-constant-mysqlcompatmysqlres-error-on-snow-leopard/

Grant Sayer
  • 2,330
  • 1
  • 23
  • 34
  • He shoots! He scores!... The root issue being that the 2.8.x MySQL Gem seems to not work on Snow Leopard but 2.7 works just find. Thank you, thank you, thank you! Note - In order to make this work I also had to add "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/" to my .bash_login file per [link]http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serve which discusses the other error I got after downgrading to 2.7. Thanks again. – Mr. Wobbet Feb 07 '11 at 02:04
1

For El Capitan you don't need to uninstall / install.

Just found your libmysqlclient.18.dylib file. Location will depent on how you installed mysql

locate libmysqlclient.18.dylib

Once you have the path create a symb link as:

ln -s /usr/local/mysql-5.5.20-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

You have two change first param according to your dynamic library location (use the first command).

On El Capitan the link should be to /usr/local/lib. On previous versions link was to /usr/lib/

Arnold Roa
  • 7,335
  • 5
  • 50
  • 69