About rubygems

Hi all.
My host install ruby in /usr/local/ but install rubygems in /home/user/
ruby/.
so, when I startup my rails project it always return error to me said
that it couldn’t find any rubygems lib.

anybody knows how to solve it? thanks!

HeChian wrote:

Hi all.
My host install ruby in /usr/local/ but install rubygems in /home/user/
ruby/.
so, when I startup my rails project it always return error to me said
that it couldn’t find any rubygems lib.

anybody knows how to solve it? thanks!

Type whereis gem and see if your symlinks were setup properly. If not,
you need to type:

sudo ln -s /home/user/bin/gem1.8 /usr/local/bin/gem

… and substitute the path for path where your gem1.8 file is located
and to the /usr/local/ file.

If your symlinks are all setup and you are able to sudo gem -v then
ignore the above. It will then just be a matter for you to set the
require ‘rubygems’ in your ruby scripts.

Place require ‘rubygems’ at the top of your scripts that require gems.

Thanks for reply
but I can’t use sudo command :frowning:
在 2009/6/29 下午 12:09 時, Älphä Blüë 寫到:

On Jun 29, 12:01 am, HeChian [email protected] wrote:

Hi all.
My host install ruby in /usr/local/ but install rubygems in /home/user/
ruby/.
so, when I startup my rails project it always return error to me said
that it couldn’t find any rubygems lib.

anybody knows how to solve it? thanks!

Did you try adding /home/usr/ruby to ruby’s search path
eg

ruby -I/home/user/ruby script/console

If that works then you can get ruby to automatically add that for you
by setting the RUBYOPT environment variable to “-I/home/user/ruby”

Fred

Assuming that you mean they install gems (the packages, not the
package manager rubygems) in /home/user/gems, take a look at this
article on setting GEM_HOME:

http://helpdesk.bluehost.com/index.php/kb/article/000365

–Matt J.