Problem with rubygems , " no such file to load "

Hi !

I’m doing a new installation of rails , but i get a big problem with
rubygem :

[[email protected] test_projet_rails]# ruby script/console

Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again:
http://rubygems.rubyforge.org

[[email protected] test_projet_rails]# gem -v

1.2.0

[[email protected] test_projet_rails]# irb

irb(main):001:0> require ‘rubygems’
LoadError: no such file to load – rubygems
from (irb):1:in `require’
from (irb):1
irb(main):002:0>

What’s wrong with my configuration ?

Thanks !

2008/8/4 Frioffol F. [email protected]:

[[email protected] test_projet_rails]# gem -v

What’s wrong with my configuration ?

Maybe you have two Ruby installations. The one that is started by “ruby”
and “irb” doesn’t have a gem installation. The one that the “gem”
command
uses, does.

Compare the output of:

$ cat `which gem` | head -n 1

$ ls -l `which ruby`

Stefan

Stefan L. wrote:

2008/8/4 Frioffol F. [email protected]:

[[email protected] test_projet_rails]# gem -v

What’s wrong with my configuration ?

Maybe you have two Ruby installations. The one that is started by “ruby”
and “irb” doesn’t have a gem installation. The one that the “gem”
command
uses, does.

Compare the output of:

$ cat `which gem` | head -n 1

$ ls -l `which ruby`

Stefan

bingo !
that was the problem…

[[email protected] test_projet_rails]# cat which gem | head -n 1
#!/usr/bin/ruby
[[email protected] test_projet_rails]# ls -l which ruby
-rwxr-xr-x 1 root root 1931641 aoû 1 11:40 /usr/local/bin/ruby

but how can i update the path and use just one ruby version ?

i tried to install ruby sources first but for different reasons, i use
the fedora installer ‘yum’.

i’m not an expert in system and i need some help…

thanks a lot

thanks to take all this time to help me…

this is better, after i removed the compiled version i get that :

[[email protected] src]# cat which gem | head -n 1
#!/usr/bin/ruby
[[email protected] src]# ls -l which ruby
-rwxr-xr-x 1 root root 3748 jui 1 10:33 /usr/bin/ruby

great ! but i when i try to run ruby that’s a drama…

[[email protected] src]# ruby
-bash: /usr/local/bin/ruby: No such file or directory

My path is :

/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

maybe another thing to do for updating the path ?

2008/8/4 Frioffol F. [email protected]:

[[email protected] src]# ruby
-bash: /usr/local/bin/ruby: No such file or directory

My path is :

/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

maybe another thing to do for updating the path ?

Yes, bash caches the ruby -> /usr/local/bin/ruby association.
Here’s a description:
http://blog.byohosting.com/2008/01/17/how-to-clear-shell-command-path-cache/

If everything else fails, open a new shell.

Stefan

2008/8/4 Frioffol F. [email protected]:

[[email protected] test_projet_rails]# cat which gem | head -n 1
#!/usr/bin/ruby
[[email protected] test_projet_rails]# ls -l which ruby
-rwxr-xr-x 1 root root 1931641 aoû 1 11:40 /usr/local/bin/ruby

but how can i update the path and use just one ruby version ?

i tried to install ruby sources first but for different reasons, i use
the fedora installer ‘yum’.

It seems that you have one ruby that was installed by your package
manager (the /usr/bin/ruby one) and one manual installation.

It is not a good idea to remove the one installed by the package
manager because other packages might depend on it.

You can remove the manual installation by deleting ruby, ri, rdoc,
erb and testrb from /usr/local/bin and deleting everything with
ruby in its name from /usr/local/lib.

OTOH, having two ruby installations is not a problem at all. Just
keep in mind that /usr/local comes first in your path. If you
want to use that, get & install the rubygems package from rubyforge.
That installs a gem command in /usr/local which again should shadow
the /usr/bin one.

Stefan

Stefan L. wrote:

2008/8/4 Frioffol F. [email protected]:

[[email protected] src]# ruby
-bash: /usr/local/bin/ruby: No such file or directory

My path is :

/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

maybe another thing to do for updating the path ?

Yes, bash caches the ruby -> /usr/local/bin/ruby association.
Here’s a description:
http://blog.byohosting.com/2008/01/17/how-to-clear-shell-command-path-cache/

If everything else fails, open a new shell.

Stefan

all is working fine…

thanks a lot for your help.