How to find and install rubygems on Cygwin

I’m a newbie as far as Ruby goes, and I want to install rubygems in
Cygwin. I have Ruby installed, but I don’t know what I need to install
gems. This message shows that it can’t find, or I don’t have the files
needed:
$ gem install -r net-ssh
/cygdrive/c/ruby/bin/gem:9:in `require’: no such file to load –
rubygems (LoadE
rror)
from /cygdrive/c/ruby/bin/gem:9

Can anyone tell me what I need to download, and where I can it?
Thanks in advance…

Alle lunedì 3 settembre 2007, Peter V. ha scritto:

Can anyone tell me what I need to download, and where I can it?
Thanks in advance…

I don’t use Cygwin (or windows), so my instructions may be inaccurate.
gem is
a command provided by rubygems, so you can’t use it to install rubygems
itself. To do this, instead, you should go to the rubygems project page
on
rubyforge (http://rubyforge.org/projects/rubygems/) and download it.
After
following the ‘download’ link, you’ll be able to choose between a gzip
and a
zip file (the other file, rubygems-update-0.9.4.gem can only be used if
you
already have rubygems installed). After downloading the file, uncompress
it,
cd into the directory you just created and issue the command

ruby setup.rb

This should be enough to install it.

I hope this helps

Stefano

Stefano,
I tried your directions and everything now works thank you very much!
Thanks also to everyone who responded. Hopefully I’ll be able to help
you all out someday.
Peter V.

Stefano C. wrote:

Alle lunedì 3 settembre 2007, Peter V. ha scritto:

Can anyone tell me what I need to download, and where I can it?
Thanks in advance…

I don’t use Cygwin (or windows), so my instructions may be inaccurate.
gem is
a command provided by rubygems, so you can’t use it to install rubygems
itself. To do this, instead, you should go to the rubygems project page
on
rubyforge (http://rubyforge.org/projects/rubygems/) and download it.
After
following the ‘download’ link, you’ll be able to choose between a gzip
and a
zip file (the other file, rubygems-update-0.9.4.gem can only be used if
you
already have rubygems installed). After downloading the file, uncompress
it,
cd into the directory you just created and issue the command

ruby setup.rb

This should be enough to install it.

I hope this helps

Stefano

Peter V. wrote:

Can anyone tell me what I need to download, and where I can it?
Thanks in advance…

I think you need to change the path where rubygems searches for
libraries. You obviously have the “gem” executable, but gem is running
“require ‘rubygems’”, which is failing. You should find rubygems.rb and
note its folder. Say it’s in /cygdrive/c/ruby/lib/, for example. You can
start ruby with that information: ruby -I /cygdrive/c/ruby/lib/. It is
up to you whether to type that manually each time you need to (i.e.,
ruby -I /cygdrive/c/ruby/lib/ /cygdrive/c/ruby/bin/gem install -r
something), or write a wrapper script that calls the ruby executable
with that argument. The second solution will work for any invocation of
ruby, while you can obviously only utilize the first solution if ruby
starts because you typed “ruby” on the command line (might as well use
an alias, if that’s the case).

But it seems like this shouldn’t be a problem… are there any better
ways to install ruby on cygwin? (I haven’t used cygwin in years…)

Dan