# 'env ruby -v' returns nothing

**URL:** <https://www.ruby-forum.com/t/env-ruby-v-returns-nothing/52568>\
**Category:** Ruby\
**Created:** [January 16, 2006, 4:18pm UTC](https://www.ruby-forum.com/t/env-ruby-v-returns-nothing/52568 "2006-01-16T16:18:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 16, 2006, 4:18pm UTC](https://www.ruby-forum.com/t/env-ruby-v-returns-nothing/52568/1 "2006-01-16T16:18:53Z")

</div>

Hi everyone,

I’'m trying to figure out why rubygems won’t install correctly on this  
particular RHEL4 box, but it does on others. Obviously, it’s an  
environment issue, but I can’t track down where. here are some  
details:

Compiling ruby 1.8.4 on 6 RHEL4 machines. 5 were ok. The one I do  
the most dev on is not. Ruby works fine, but rubygems does not:

# gem -v

/usr/local/bin/gem: line 3: require: command not found  
/usr/local/bin/gem: line 4: Gem.manage\_gems: command not found  
/usr/local/bin/gem: line 6: syntax error near unexpected token `(' /usr/local/bin/gem: line 6:`required\_version =  
Gem::Version::Requirement.new("\>= 1.8.0")’

gem installs with ‘/usr/bin/env ruby’ as the default startup line, but  
running this myself returns zilch:

# /usr/bin/env ruby

# /usr/bin/env ruby -v

# which gem

/usr/local/bin/gem

# which ruby

/usr/local/bin/ruby

# 

Changing the shebang line in /usr/local/bin/gem to use  
/usr/local/bin/ruby works as far as gem -v goes, but I’m afraid to use  
it if I don’t know what env vars it might use otherwise.

I have no ruby-based rpms installed anymore (I did once, but they  
haven’t been updated since 1.8.1, so I scrapped them). I’ve rm -rf’ed  
the entire ruby distribution and started from scratch, so I’m thinking  
it must be environment. Does anybody have a suggestion as to what  
could cause this? I see no obvious discrepancies between this machine  
and any of the other 5. Where should I look next?

Thank you!

Sean

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 16, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/env-ruby-v-returns-nothing/52568/2 "2006-01-16T17:28:26Z")

</div>

On 1/16/06, Sean H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> # /usr/bin/env ruby
> 
> # /usr/bin/env ruby -v
> 
> # which gem
> 
> /usr/local/bin/gem
> 
> # which ruby
> 
> /usr/local/bin/ruby
> 
> Changing the shebang line in /usr/local/bin/gem to use  
> /usr/local/bin/ruby works as far as gem -v goes, but I’m afraid to use  
> it if I don’t know what env vars it might use otherwise.

It certainly does sound like an environment issue. My guess is the  
PATH doesn’t include /usr/local/bin, but if you can run ‘gem’ that  
couldn’t be it. Try running ‘/usr/bin/env’ (without the ‘ruby -v’) on  
each machine. This prints out the current environment and you can  
compare to find the environment differences.

Jacob F.

---

<div class="post-metadata">

**Author:** ![seanhussey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a88e57/32.png) [@seanhussey](https://www.ruby-forum.com/u/seanhussey)\
**Post date:** [January 17, 2006, 1:09am UTC](https://www.ruby-forum.com/t/env-ruby-v-returns-nothing/52568/3 "2006-01-17T01:09:33Z")

</div>

Whoa. Check this out. On one of the “good” machines (some info  
snipped):

# /usr/bin/env

HOSTNAME=blah  
TERM=xterm-color  
SHELL=/bin/bash  
HISTSIZE=100  
SSH\_CLIENT=::ffff:10.4.74.75 49771 22  
SSH\_TTY=/dev/pts/0  
USER=root  
LS\_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:_.cmd=01;32:_.exe=01;32:_.com=01;32:_.btm=01;32:_.bat=01;32:_.sh=01;32:_.csh=01;32:_.tar=01;31:_.tgz=01;31:_.arj=01;31:_.taz=01;31:_.lzh=01;31:_.zip=01;31:_.z=01;31:_.Z=01;31:_.gz=01;31:_.bz2=01;31:_.bz=01;31:_.tz=01;31:_.rpm=01;31:_.cpio=01;31:_.jpg=01;35:_.gif=01;35:_.bmp=01;35:_.xbm=01;35:_.xpm=01;35:_.png=01;35:_.tif=01;35:  
MAIL=/var/spool/mail/root  
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/libexec:/root/bin  
INPUTRC=/etc/inputrc  
PWD=/root  
LANG=en\_US.UTF-8  
SHLVL=1  
HOME=/root  
LESSOPEN=|/usr/bin/lesspipe.sh %s  
G\_BROKEN\_FILENAMES=1  
\_=/usr/bin/env

# 

Now, on the “bad” machine:

# /usr/bin/env

# 

Huh?!
