After updating to OSX 10.9 and switching over to zsh I started experiencing problems with my Rails install. I started receiving the following error every time I ran “rails s -p 12345”:
vendor/bundle/gems/sqlite3-1.3.8/lib/sqlite3.rb:6:in `require': dlopen(vendor/bundle/gems/sqlite3-1.3.8/ lib/sqlite3/sqlite3_native.bundle, 9): Library not loaded: /usr/local/lib/libsqlite18.104.22.168.dylib (LoadError)
After following numerous guides on Stackoverflow and other sites I was still experiencing the problem. Thus I changed my approach and the end result was everything working as normal. This approach is longer but at least it works and should cut the frustration.
Firstly remove everything associated with sqlite3:
brew uninstall sqlite3 sudo gem uninstall sqlite3 sudo gem uninstall sqlite3-ruby
Next I downloaded the sqlite-autoconf from http://www.sqlite.org/download.html and extracted it. Then I build sqlite from source using the following build command:
sudo CFLAGS='-arch i686 -arch x86_64' LDFLAGS='-arch i686 -arch x86_64' ./configure --disable-dependency-tracking sudo make install
Once installed I used rvm to create a new gemset (just incase I forgot to remove anything) and then ran bundler
rvm use 2.0.0@CPS --create --ruby-version bundle install
The result of all of this was a working Rails installation. I am not sure what causes all the issues between the gem and sqlite but as far as I can tell it has to do with Homebrew changing the sqlite to be a Keg only release, and thus it is not linked to the correct place anymore.
Hope it helps