When setting up a Ruby/Rails development environment utilizing Ubuntu 12.04 LTS you may find yourself running into issues with setting your RVM default Gemset.
rvm use 1.9.3-p286@rails3 --rvmrc
When setting up a Ruby/Rails development environment utilizing Ubuntu 12.04 LTS you may find yourself running into issues with setting your RVM default Gemset.
rvm use 1.9.3-p286@rails3 --rvmrc
On the latest version of Linux Mint 12 (the Linux platform I prefer for Ruby development) I ran a bundle install on a small application using Sqlite3 and ran into the following error message. After a little Google search I found that my installing Sqlite3 did not give Gem all the build files it requires to build the Sqlite3-ruby gem with native extensions. So if you are running into the same issue make sure you run the following commands prior to running bundle install.
<<<>>>
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
<<<>>>
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/tim/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Try ‘port install sqlite3 +universal’
or ‘yum install sqlite-devel’ and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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
–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=/home/tim/.rvm/rubies/ruby-1.9.2-p290/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}/lib
–enable-local
–disable-local
Gem files will remain installed in /home/tim/.rvm/gems/ruby-1.9.2-p290@CorDev1.9.2/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/tim/.rvm/gems/ruby-1.9.2-p290@CorDev1.9.2/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
If you are running into errors when installing the Ruby Gem Nokogiri and the error you are getting has to do with the library ‘libxml2’ not being available you will need to execute the following commands to fix it.
Original Error Message Reference:
checking for libxml/parser.h… no
—–
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
—–
*** 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.
Step 1: Setup your Ruby 1.9.2-head
$ rvm 1.9.2-head
WARN: ruby ruby-1.9.2-head is not installed.To install do: ‘rvm install ruby-1.9.2-head’
Step 2: Install the utilities need to build the head
$ sudo apt-get install bison
$ sudo apt-get install autoconf
Step 3: Install your Ruby 1.9.2-head
$ rvm install ruby-1.9.2-head
Step 4: Create your new GemSet
$ rvm gemset create corerivalry
Step 1: First we need to install all the required libraries
$ sudo apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev
Step 2: Install RVM
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Step 3: mint 10 does not have a .bashrc file so one needs to be added and then RVM specific lines added
$ sudo touch .bashrc
$ sudo gedit .bashrc
(Add line to .bashrc file)
if [[ -s "$HOME/.rvm/scripts/rvm" ]]Â ; then source "$HOME/.rvm/scripts/rvm" ; fi
Step 4: close the current terminal and open a new one in order to load the new commands
Step 5: verify RVM has been installed by running you should get back a description of the application written by the author
$ rvm notes
Step 6: now you can install the ruby version of your choice, I am using 1.9.2 so it is compatible with Rails 3
$ rvm install 1.9.2
Step 7: once installed you will need to set the default ruby version to be used by RVM
$ rvm --default ruby-1.9.2
Step 8: verify that the version you selected is now accessible via the standard ruby command
$ ruby -v
Step 9: then use the gem command to install the rails version of your choice
$ gem install rails
Step 10: install MySQL
$ sudo apt-get install libmysql-ruby libmysqlclient-dev$ gem install mysql2
See the list of Snippets and their codes on Google docs at the following URL
https://docs.google.com/document/d/1yZtk2qqf9Ev3YZxy79J5o76MeijLeR1qjt6pNwaNP2o/edit?hl=en&authkey=COXQ35cM