Arie’s Blog

Rails on OS X: no such file to load — mysql

March11

Just a quick post to maybe help someone who has a similar problem:

I had the following error whenever I tried to use ’script/console’ (script/server and rake worked fine)

require ‘mysql’

MissingSourceFile: no such file to load — mysql
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’

Turns out I had multiple versions of RubyGems installed on my Macbook. The error message already spoils it by saying rubygems in /System/Library/Framework/ is being called, while I actually installed rubygems manually in a different folder.

To prevent these kind of problems in the future I simply deleted the entire Ruby.framework directory and use the manually installed versions instead.

posted under Programming, Software
2 Comments to

“Rails on OS X: no such file to load — mysql”

  1. On March 11th, 2009 at 15:03:25 Stefan Says:

    Did you alter the symlinks in /usr/bin? /usr/bin/ruby for example should link to /opt/local/bin/ruby if you’re using MacPorts ruby.

  2. On March 11th, 2009 at 17:03:37 Arie Says:

    Well ‘which ruby’ pointed to the right one in /opt/local/bin, ‘which gem’ pointed to the right one as well. Only when I launched ’script/console’ the wrong rubygems got loaded.

Email will not be published

Website example

Your Comment: