Skip to content

Instantly share code, notes, and snippets.

@joshdvir
Created September 8, 2011 10:34
Show Gist options
  • Save joshdvir/1203110 to your computer and use it in GitHub Desktop.
Save joshdvir/1203110 to your computer and use it in GitHub Desktop.
Install ruby 1.8.7 on OSX Lion + Mysql Gem
Decided to get started using RVM on my Mac, unfortunately, right before continuing development on an otherwise sturdy app.
Upon start-up, there were errors in the log starting with
/!\ FAILSAFE /!\ Sat Dec 11 17:17:47 -0600 2010
Status: 500 Internal Server Error
uninitialized constant MysqlCompat::MysqlRes
/Users/username/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in `load_missing_constant'
/Users/username/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `const_missing'
/Users/username/.rvm/gems/ruby-1.8.7-p302/gems/activerecord-2.3.4/lib/active_record/connection_adapters/mysql_adapter.rb:9:in `define_all_hashes_method!'
From other posts, it appears mysql simply wasn’t being loaded properly.
The full fix probably depends on whatever hacks you took to get mysql and ruby on your system the first time. I didn’t see the steps al in one place, so here they are.
1. Uninstall the mysql gem
gem uninstall mysql
2. Uninstall rvm’s ruby
rvm remove ruby-1.8.7
3. Install RVM considering the i386 architecture
rvm_archflags="-arch i386" CFLAGS="-arch i386" LDFLAGS="-arch i386" rvm install 1.8.7 --patch osx-arch-fix
4. Install mysql gem with architecture flags
env ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql/lib/ --with-mysql-config=/usr/local/mysql/bin/mysql_config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment