Ruby-on-rails – Getting Ruby on Rails environment working and installing sqlite3

ruby-on-railsruby-on-rails-3ruby-on-rails-3.2rubygemssqlite

Trying to upgrade to the latest version of Ruby on Rails. I got ruby and rails installed ok (I think).

C:\Users\benjaminw>ruby --version
ruby 2.0.0p0 (2013-02-24) [x64-mingw32]

C:\Users\benjaminw>rails -v
Rails 3.2.13

I'm following an instructional guide out of a Ruby on Rails book but it's a little out of date. The next step says to download the sqlite3 db and extract the the files to the following folder C:/Ruby200/bin

Then run the following command to make sure the db was installed correctly

C:\Users\benjaminw>sqlite3 --version
3.7.16 2013-03-18 11:39:23 66d5f2b76750f3520eb7a495f6247206758f5b90

Here is where the problem arises. When I enter the next command I get an ERROR and it seems like it's important to setting up the environment properly. Does anyone know what the following means and how to fix it? Oh and I installed this version of the devkit on my windows 7 computer DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe.

C:\Users\benjaminw>gem install sqlite3-ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

C:/Ruby200/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=C:/Ruby200/bin/ruby
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/
    --enable-local
    --disable-local


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1
.3.7 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/
gem_make.out

Best Answer

Running rails in a lousy environment will make things a bigger headache for you. Dependencies will conflict with your only ruby version and make you consider re-installing your OS.

It looks like you are using Windows. I installed rails 3.2 on a fresh Windows 8 computer. After a few days of dealing with config files randomly throughout windows filesystem I grabbed an old laptop installed Ubuntu OS (only because UEFI prevented me from formatting windows 8 and installing ubuntu).

Do yourself a favor! Get an installation of Ubuntu. It makes it way easier to learn Ruby and Rails because the files aren't littered across a mess of windows folders.

To finish, learn about RVM or RBENV. They will make your life better by installing easily and switching versions even easier. There are other benefits that are just to off-topic.

RVM Install <- Personal choice, but I haven't tried RBEnv.

RBEnv on Github

Installing Rails for the first few times is a headache. If you install with one of the above options hopefully it will only be one headache.

Related Topic