# 'ruby script/server' responds with: "Missing the Rails gem. ..." \<-- not true. Why?

**URL:** <https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450>\
**Category:** Rails\
**Created:** [August 26, 2009, 9:30pm UTC](https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450 "2009-08-26T21:30:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@ric](https://www.ruby-forum.com/u/ric)\
**Post date:** [August 26, 2009, 9:30pm UTC](https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450/1 "2009-08-26T21:30:00Z")

</div>

Here’s my environment (Mac OS X 10.5.8):  
[/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

1. 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.

1. 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.

1. 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?

---

<div class="post-metadata">

**Author:** ![ric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@ric](https://www.ruby-forum.com/u/ric)\
**Post date:** [August 26, 2009, 9:52pm UTC](https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450/2 "2009-08-26T21:52:50Z")

</div>

On Aug 26, 7:45 pm, “Frederick C. Lee” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [/Users/Ric/workarea/rails/demo/config]sudo gem update --system  
> But I found it here:

sudo cleans the environment up before it runs so may end up with a  
different $PATH.

> 1. 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?

I think you have two ruby installations: a ruby 1.8.6 installation  
that came with os x. that version of ruby has the rails gem installed,  
and running rails -v finds a /usr/bin/rails installed by ruby 1.8.6.  
You have since installed ruby 1.9.1, and ruby invokes that. That ruby  
install does not have the rails gem installed.

you could verify this by playing with gem list (and looking at the  
difference between /usr/bin/gem list and /opt/local/bin/gem list )

Fred

---

<div class="post-metadata">

**Author:** ![ric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@ric](https://www.ruby-forum.com/u/ric)\
**Post date:** [August 27, 2009, 9:13am UTC](https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450/3 "2009-08-27T09:13:00Z")

</div>

On 8ÔÂ27ÈÕ, ÉÏÎç2Ê±45·Ö, “Frederick C. Lee” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [/Users/Ric/workarea/rails/demo/config]sudo gem update --system  
> But I found it here:
> 
> Missing the Rails gem. Please `gem install -v= rails`, update your
> 
> Is there some sort environment setup that I’m missing?  
> maybe you should reinstall rubygem.

---

<div class="post-metadata">

**Author:** ![ric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@ric](https://www.ruby-forum.com/u/ric)\
**Post date:** [August 27, 2009, 10:10am UTC](https://www.ruby-forum.com/t/ruby-script-server-responds-with-missing-the-rails-gem-not-true-why/174450/4 "2009-08-27T10:10:22Z")

</div>

Modify your path to use /opt/local/bin before /usr/bin
