Matt Elhotiby
Matt Elhotiby

Reputation: 44066

Why are the gems not showing up?

So this happens to me regularly, where i have gems that are installed but for some reason my rails app is not finding it...here is my example

my config/environment.rb

config.gem "whenever"

my install

sudo gem install whenever
Password:
Successfully installed whenever-0.6.2
1 gem installed

gem list | grep when
whenever (0.6.2)


script/server 
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
Missing these required gems:
  whenever  

You're running:
  ruby 1.8.7.174 at /usr/local/bin/ruby
  rubygems 1.3.7 at /Users/matt/.gem/ruby/1.8, /usr/local/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.


 gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.4.0]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-10
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.8
     - /Users/matt/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com", "http://gemcutter.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com
     - http://gemcutter.org


$ which gem
/usr/local/bin/gem
$ which ruby
/usr/local/bin/ruby

Does anybody see the issue because i clearly cant even start my server and i know the gem is installed. I am on a macbook pro with Snow leopard by the way...

Upvotes: 0

Views: 2006

Answers (2)

goutham_kgh
goutham_kgh

Reputation: 167

I had two different 1.9.x ruby versions, and I had installed rvm. All the gems installed through rvm were not showing up. Basically my "which gem" was showing /usr/bin/gem while it was supposed to be "/home/gh/.rvm/rubies/ruby-1.9.x/bin/gem"

If such is the case, in your gnome-terminal, under Edit > Profile Preferences > Title and Command, check the option "Run command as a login shell"

This integrates rvm with gnome-terminal :) Hope this helps someone who faced the same issue as I did.

Reference: https://rvm.io/integration/gnome-terminal

Upvotes: 0

Rishav Rastogi
Rishav Rastogi

Reputation: 15482

Please check you ruby and gem installation :

May be use these commands

 which ruby
 which gem 

and make sure they have the correct path.

Most times people have these problems is that "gem" command installs gems into a different ruby installation instead of the one used by your rails app.

Upvotes: 1

Related Questions