Ruby on rails install run error

Ruby on rails is such a powerful tool but it won’t be powerful enough when you run the server for the first time and encountered into this error

/usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_ruby (LoadError)

from /usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:6:in `rescue in '

from /usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb:2:in `'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'

from /usr/local/share/gems/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'

from /home/ahmed/Ruby WorkShop/railsLab/config/application.rb:7:in `'

from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'

from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in '

from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'

from /usr/local/share/gems/gems/railties-3.2.13/lib/rails/commands.rb:50:in `'

from script/rails:6:in `require'

from script/rails:6:in `'

I was desperate for more than 3 days with this error, silly I know, but the answer was pretty easy even more hilarious when you know that i have found the answer on a Japanese or may be Chinese blog I am not a Language expert so sorry about that any way.


The reason behind that error wasn’t because I haven’t installed sqlite3, and believe me I have installed it over and over and over again so what was the reason.


The reason behind that I think because when ever it required to load sqlite3 it wasn’t there where it is supposed to be


so how we gone fix it.
First of all you will need to install ruby-devel

yum install ruby-devel

nano   /usr/local/share/gems/gems/sqlite3-1.3.7/lib/sqlite3.rb

when you open this file it will be like this

# support multiple ruby version (fat binaries under windows)
RUBY_VERSION =~ /(\d+\.\d+)/
require "sqlite3/#{$1}/sqlite3_native"
rescue LoadError
require 'sqlite3/sqlite3_native'

require 'sqlite3/database'
require 'sqlite3/version'

What you will have to do is to copy this file to some place in case this fix was useless to you.
Then you will have to replace those lines with the right place for sqlite3

require "sqlite3/#{$1}/sqlite3_native"
rescue LoadError
require 'sqlite3/sqlite3_native'

So you will start asking your self with what don’t worry
after you run this command on the terminl

find /usr/local/share/gems/gems/ -name sqlite3_native*

it will give you a line of code that is similar to this


Copy that whole line except .so
and replace it with the previous line and the result will have to be like this

require '/usr/local/share/gems/gems/sqlite3-1.3.7/ext/sqlite3/sqlite3_native'
rescue LoadError
require '/usr/local/share/gems/gems/sqlite3-1.3.7/ext/sqlite3/sqlite3_native'

and here we are
rails server
Congratulations you server is up and running

And may I thank the Japanese guy 😀

Fedora 17 (Linux)

Tagged ,

بسم الله الرحمن الرحيم

(Peace on all of you) السلام عليكم


Let me introduce my self to you, my name is Ahmed Emad, Mobile Developer who loves his Job, Egyptian, Muslim.I love Technology.Always love to learn more.

I have never been a blogger, never thought I will, but I came across this specific question will it hurt?, besides I have always learned that the more I pass my knowledge the more it benefits me more so why not, and may be I will be able to learn new thing my self.