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 :D

Fedora 17 (Linux)

About these ads
Tagged ,

One thought on “Ruby on rails install run error

  1. E9 says:


    I’m experiencing the same error. Please bear in mind that I’m have absolutely no coding experience. If I don’t have yum installed, is there anyway I can fix the problem? I’m using Mac OS 10.8.4, Ruby 2.0.0 Rails 4.0.0.

    Many thanks in advance,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: