Really need help with gems not being found

I love Rails, but I'm beginning to think that there are some very broken things about it. Case in point:

- I'm on OS X, and at some point added rails using MacPorts, putting most of my gems in /opt/local/lib/ruby/gems/1.8

- when I add gems, they are added in that directory BUT

- when I run (eg) rake tasks, the gems are not found. I've tried using

ENV['GEM_PATH'] = '/opt/local/lib/ruby/gems/1.8'

to force the app to only look there, but it still doesn't see them. I get messages like

Missing these required gems:   rmagick   authlogic

You're running:   ruby 1.8.7.174 at /System/Library/Frameworks/Ruby.framework/Versions/ 1.8/usr/bin/ruby   rubygems 1.3.5 at /opt/local/lib/ruby/gems/1.8, /Library/Ruby/Gems/ 1.8

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

Which I do, using sudo, and everything seems to go fine, but when I run rake again, they aren't seen.

Where am I going wrong? What is wrong with Rails that this can't be configured simply? What is wrong with me that I can't figure this out?

You have 2 ruby installs (one in /opt and one in /lib) and you are installing gems into one install but then running rake from the other one. You could either get rid of one of the installs or make sure that your /opt ruby has rake installed and that $PATH is such that ruby/ rake/gem are all picked from the same ruby install.

Fred

omnivore wrote:

I love Rails, but I'm beginning to think that there are some very broken things about it.

[...]

As Fred said, Rails isn't broken. Your Ruby installation is. Next time, ask for help without creating FUD.

Best,

Solution was simple, once I found it. Change the bang line in the rake.rb, found via 'which rake' to point to the ruby version that houses the gems. Now things work.

Put differently, now its not broken. The breakage came as a result of Rails using the $PATH variable when installing gems, not when it runs rake. So, yes, rails is broken in this case – this underdocumented behaviour arose not out of misconfiguration, but the normal use of the $PATH producing a non-functional behaviour.

Next time, feel free to provide an actual answer, or refrain from answering if the best contribution is limited to patronizing snark.

BTW, are you wearing shoes these days? Don't want to hurt your feet when you're Morris Dancing Ze'ev. Or should I call you Lord Marnen of Wolfhurst?

heheheh.

Don't bother thanking anyone for pointing you at the cause of the problem. They are only in it for the money anyway.

Colin

Colin, I naturally did send Frederick Cheung (hope I have the name right) thanks directly, although his answer did not actually solve the problem, and reiterated advice that I also found on (IIRC) stackoverflow. He did clue me in to checking the locations of ruby, rake and gems, and I found another clue on another site, where a similar problem was documented. Of course, I thanked that person profusely. I think that's pretty much adequate, and if anyone here had solved the problem, of course I would have thanked them. I understand quite clearly how these exchanges work.

The point of my last post was that one respondent seemed more focussed on topics irrelevant to my question, made remarks that were gratuitously judgmental, and what he contributed was unhelpful to others with a similar problem. Signal to noise is important, is it not?

Other than that – and with no desire to extend this uneccesarily – what point of etiquette did I miss, in your opinion?