views:

37

answers:

2

I've been fighting with a Rails install on my Mac for some time. The error I'm getting (in my development log) says:

Status: 500 Internal Server Error no such file to load -- mysql

Here's some info:

  • I can successfully rake db:migrate my application
  • I've installed the MySQL gem and it appears in the gem list: mysql (2.8.1)
  • I have Passenger installed
  • The error comes from an existing rails app that works on our production server
  • Creating a new Rails app, a new MySQL db (via mysqladmin -uroot create sampledb) works fine

I've googled this and can't find anything specific to this error. There are a few related results where the solutions relate to paths when installing the MySQL gem. For example,

sudo env ARCHFLAGS="-arch i386" gem install mysql -- \ --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \ --with-mysql-include=/usr/local/mysql/include

Has anyone else experienced this issue or suggest a solution?

Thanks, Scott

A: 
  1. Do you have multiple ruby installed? Try invoking this command to find out: whereis ruby
  2. Which ruby version is you passenger using? You can check this from your apache or nginx configuration
  3. Is the ruby version passenger is using the same as ruby you are using from the command line?
  4. Is mysql gem installed on that ruby version?
jpartogi
A: 

Thanks for the response - the good news is, the problem is solved. The bad news - I'm not entirely sure what fixed it. I can tell you this: it had something to do with the mysql gem install and all the flags pointing to lib, include and config. There are probably a dozen different versions of the same command floating around out there for Mac OS X Leopard. The odd thing was that ruby appeared to be connected to mysql on some level (it's ability to rake db for example) but broke when actually loading a page.

The gem install string that ended up working was this:

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

I'd love some clarification on the how's & why's of this. This worked for me, but doesn't include pointers to the app directory, the lib directory or the include directory.

Scott

Scott Oppliger