small medium large xlarge

Calcite_pragsmall
26 Aug 2009, 17:01
Frederick C. Lee (22 posts)

Greetings: Here’s my environment/setup:

[/Users/Ric/workarea/rails/demo]ruby --version
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9]

[/Users/Ric/workarea/rails/demo]rails --version
Rails 2.3.3

[/Users/Ric/workarea/rails/demo]gem --version
1.3.5


[/Users/Ric/workarea/rails/demo/config]sudo gem update --system
Password:
Updating RubyGems
Nothing to update

I attempted to update rubygems, even though I don’t need to:

[/Users/Ric/workarea/rails/demo/config]sudo update_rubygems
sudo: unable to execute /opt/local/bin/update_rubygems: No such file or directory

But I found it here:

[/usr/bin]ls -l update_rubygems
-rwxr-xr-x  1 root  wheel  462 Aug 25 15:02 update_rubygems*

But if I use ‘sudo’, it looks for ‘update_rubygems’ here:

[/usr/bin]sudo update_rubygems
sudo: unable to execute /opt/local/bin/update_rubygems: No such file or directory

2) Why?

Anyway, I forced it:

[/usr/bin]sudo ./update_rubygems
Installing RubyGems 1.3.5
RubyGems 1.3.5 installed

[/usr/bin]gem --version
1.3.5

Checking rails:

[/Users/Ric/workarea/rails/demo]which rails
/usr/bin/rails

[/Users/Ric/workarea/rails/demo]ls -l /usr/bin/rails
-rwxr-xr-x  1 root  wheel  422 Aug 25 13:21 /usr/bin/rails*

=================

I. Attempted to start default Rails Server:

Missing the Rails  gem. Please `gem install -v= rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

3) Huh?


I tried commenting out the RAILS_GEM_VERSOIN in config/environment.rb:

# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
#RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
...

II. Attempted to create a controller per book:

[/Users/Ric/workarea/rails/demo]ruby script/generate controller Say
Missing the Rails  gem. Please `gem install -v= rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

4) Huh?

As you can see, I have the latest Ruby, Rails & Gem already installed & running. Is there some sort environment setup that I'm missing?

Calcite_pragsmall
30 Aug 2009, 22:23
Frederick C. Lee (22 posts)

I tried using Ruby 1.8.7 vs Ruby 1.9.1 (installed via MacPorts). No change. I tried setting RUBYOPT in my environment; No Effect.

Does anyone know the inner works of Rails/Ruby & Gem? I have all the parts, but apparently environment.rb can’t find ‘GEM’.

Generic-user-small
06 Sep 2009, 05:16
William DeVaul (3 posts)

Try: which ruby which gem echo $PATH

You may be running from /usr/bin or /usr/local/bin when gem is installed in the other location and/or your $PATH prevents proper loading. I do not use MacPorts so I cannot help there but the $PATH concept should be the same.

If you notice a discrepancy, you might update your $PATH variable for your shell. For me it’s: mate ~/.bash_profile # to edit in textmate and then: source ~/.bash_profile # to reload the $PATH

You must be logged in to comment