Monday, July 12, 2010

Problem Installing Sqlite3-ruby on Snow Leopard

I was getting this error when I started the server. I had installed RVM, Ruby 1.9.1, Rails 3.0 Beta 4:

.rvm/gems/ruby-1.9.1-p378/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: dlopen(.rvm/gems/ruby-1.9.1-p378/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle, 9): no suitable image found. Did find: (LoadError)
.rvm/gems/ruby-1.9.1-p378/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: mach-o, but wrong architecture - .rvm/gems/ruby-1.9.1-p378/gems/sqlite3-ruby-1.3.1
/lib/sqlite3/sqlite3_native.bundle


Resolution:

Uninstall sqlite3-ruby (1.3.1)
1. gem uninstall sqlite3-ruby

Install sqlite3-ruby version 1.2.5
2. gem install sqlite3-ruby --version 1.2.5

If you get the error:

no such file to load -- sqlite3

when running rake db:migrate

Edit the Gemfile for the line sqlite3-ruby as :

gem 'sqlite3-ruby', :require => 'sqlite3'