How to resolve factory girl 4.2.0 conflict with ruby 1.9.2 during metasploit framework installation

  In this post,I'm going to share one of the problem that I face during the installation of Metasploit framework from Github on my system .You can check my full installation post here .

Before I go into details. please find below program term and short explanation that is used associated with Ruby.Please click the link for more information.

bundler =Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed .Please check it out here

gems=RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them. Please refer here for details

rbenv = rbenv is  a program to pick a Ruby version for your application and guarantee that your development environment matches production .Please refer here for more information .

This problem happen when I want to install the required gems and related version to make it work on my system

factory girl (4.2.0) error
shark_attack@Positive-Space:/opt/metasploit-framework$ sudo bundle install
Fetching gem metadata from
Fetching additional metadata from
Using rake (10.1.0)
Using i18n (0.6.5)
Using multi_json (1.0.4)
Using activesupport (3.2.14)
Using builder (3.0.4)
Using activemodel (3.2.14)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.14)
Using bcrypt-ruby (3.1.2)
Using database_cleaner (1.1.1)
Using diff-lcs (1.2.4)
Gem::InstallError: factory_girl requires Ruby version >= 1.9.2.
An error occurred while installing factory_girl (4.2.0), and Bundler cannot continue.
Make sure that `gem install factory_girl -v '4.2.0'` succeeds before bundling.
shark_attack@Positive-Space:/opt/metasploit-framework$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
shark_attack@Positive-Space:/opt/metasploit-framework$ gem -v
shark_attack@Positive-Space:/opt/metasploit-framework$ clear

  factory girl require ruby version 1.9.2 while on my system I use ruby version 1.9.3 . After a quick run through the online manual, I found out that the need to rehash  ruby to make it work with my system. Below are steps on how I do it.

Steps summary

1)Install gem bundler
2)Install rbenv

3)rehash ruby
4)bundle install


1)Install gem bundler.

shark_attack@Positive-Space:/opt/metasploit-framework$ sudo bundle install 
shark_attack@Positive-Space:/opt/metasploit-framework$ sudo gem install bundler
Fetching: bundler-1.5.3.gem (100%)
Successfully installed bundler-1.5.3
1 gem installed
Installing ri documentation for bundler-1.5.3...
Installing RDoc documentation for bundler-1.5.3...
shark_attack@Positive-Space:/opt/metasploit-framework$ rbenv rehash
The program 'rbenv' is currently not installed.  To run 'rbenv' please ask your administrator to install the package 'rbenv'

2)Install rbenv


shark_attack@Positive-Space:/opt/metasploit-framework$ sudo apt-get install rbenv
Reading package lists... Done
Building dependency tree   
Reading state information... Done
The following NEW packages will be installed:
0 to upgrade, 1 to newly install, 0 to remove and 2 not to upgrade.
Need to get 15.3 kB of archives.
After this operation, 79.9 kB of additional disk space will be used.
Get:1 precise/universe rbenv all 0.1.2+git20100922-1 [15.3 kB]
Fetched 15.3 kB in 0s (22.7 kB/s)
Selecting previously unselected package rbenv.
(Reading database ... 275787 files and directories currently installed.)
Unpacking rbenv (from .../rbenv_0.1.2+git20100922-1_all.deb) ...
Processing triggers for man-db ...
Setting up rbenv (0.1.2+git20100922-1) ...
shark_attack@Positive-Space:/opt/metasploit-framework$ clear

3)rehash ruby

shark_attack@Positive-Space:/opt/metasploit-framework$rbenv rehash

4)Run bundle install

shark_attack@Positive-Space:/opt/metasploit-framework$ bundle install
Fetching gem metadata from
Fetching additional metadata from
/var/lib/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:295: warning: Insecure world writable dir /home/shark_attack in PATH, mode 040766
Installing rake (10.1.0)
Installing i18n (0.6.5)
Installing multi_json (1.0.4)
Installing activesupport (3.2.14)
Installing builder (3.0.4)
Installing activemodel (3.2.14)
Installing arel (3.0.2)
Installing tzinfo (0.3.37)
Installing activerecord (3.2.14)
Installing bcrypt-ruby (3.1.2)
Installing database_cleaner (1.1.1)
Installing diff-lcs (1.2.4)
Installing factory_girl (4.2.0)
Installing fivemat (1.2.1)
Installing json (1.8.0)
Installing pg (0.16.0)
Installing metasploit_data_models (0.16.9)
Installing mini_portile (0.5.1)
Installing msgpack (0.5.5)
Installing network_interface (0.0.1)
Installing nokogiri (1.6.0)
Installing packetfu (1.1.9)
Installing pcaprub (0.11.3)
Installing redcarpet (3.0.0)
Installing robots (0.10.1)
Installing rspec-core (2.14.5)
Installing rspec-expectations (2.14.2)
Installing rspec-mocks (2.14.3)
Installing rspec (2.14.1)
Installing shoulda-matchers (2.3.0)
Installing simplecov-html (0.5.3)
Installing simplecov (0.5.4)
Installing timecop (0.6.3)
Installing yard (0.8.7)
Using bundler (1.5.3)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
shark_attack@Positive-Space:/opt/metasploit-framework$ clear

Next Post »