views:

3725

answers:

6

Hi, since I updated ruby using Mac Ports (on Leopard) I have got several problems and I also had to reinstall gems. Now when I run Mongrel I keep getting the error "Missing these required gems" followed by the list of gems that I required in environment.rb but that gems seems to be correctly installed as I see running gem list. I think that rails is looking for a previous installation, but I don't know how to configure it to use the new ruby/gem path.

Thanks!

A: 

Are you sure the gem command is actually the one installed by MacPorts and not the included default from OSX?

pantulis
I think it's the one installed by MacPorts: typing "which gem" I get "/opt/local/bin/gem". It seems that rails doesn't use the same gems as the line command "gem"..
collimarco
+2  A: 

This railswiki-entry gives lots of insight into handling of multiple gem-repositories. Maybe you find a clue there that solves your problem. Hope it helps

http://wiki.rubyonrails.org/rails/pages/HowToUseMultipleGemRepositories

Update: The above link is broken, the text has been saved here though: http://tek-zappeln.blogspot.com/2009/02/howtousemultiplegemrepositories-rescued.html

flitzwald
link seems to be broken
Jonathan
+2  A: 

Try this at the Terminal, and see whether the paths are similar:

which ruby
which gem

I had a similar problem just the other week, and had to rename the original gem binary so it would find the MacPorts-installed one.

Luke
$ which ruby/opt/local/bin/ruby$ which gem/opt/local/bin/gem
collimarco
A: 

You can force it to use a particular version of ruby with:

/path/to/ruby -S <command>

You could force your rails application to start using whichever version of ruby you want, you could also use this to run your gem list command and make sure you have the correct gems before you run rails.

railsninja
+8  A: 

You should use :

  config.gem 'rspec', :lib => 'spec'
  config.gem 'rspec-rails', :lib => 'spec/rails'

because rspec libs are not named as it should ...

+1 fixed my problem thanks!
jamuraa
A: 

Did you find a solution?