Help with Ruby under cygwin

In order to use git on my laptop (MS XPproSP3) I ended up installing the
cygwin environment. I tried MSysGit but it failed to run and the
maintainer was, shall we say, less than enthusiastic with my bug report.

Now, everything works from the standard windows dos box. However, when
I try and run a ruby utility such as gem, rake or rails from within the
cygwin bash shell window then each gives the same style of error:

$ which rails
/cygdrive/c/usr/lib/ruby/bin/rails
$ rails
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rails (LoadError)
$
$ which gem
/cygdrive/c/usr/lib/ruby/bin/gem
$ gem list
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/gem (LoadError)
$
$ which rake
/cygdrive/c/usr/lib/ruby/bin/rake
$ rake
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rake (LoadError)

I am not having this problem with anything else and so I am first asking
for help here since I expect the cygwin people will turn me to this
forum in the end in any case.

Any insight anyone can provide me as to what is going on here would be
most appreciated.

···

--
Posted via http://www.ruby-forum.com/.

Hm, the path to your ruby.exe looks suspicious. What's the output of
"type -a" at a bash prompt? For me it's this:

16:55:17 ~$ type -a ruby
ruby is /usr/bin/ruby
ruby is /bin/ruby
ruby is /usr/bin/ruby

Also, what does echo "$PATH" output? Maybe you are pulling the wrong Ruby.

Did you use the Ruby package that comes with cygwin or did you install
from sources?

Kind regards

robert

···

2008/6/12 James Byrne <byrnejb@harte-lyne.ca>:

In order to use git on my laptop (MS XPproSP3) I ended up installing the
cygwin environment. I tried MSysGit but it failed to run and the
maintainer was, shall we say, less than enthusiastic with my bug report.

Now, everything works from the standard windows dos box. However, when
I try and run a ruby utility such as gem, rake or rails from within the
cygwin bash shell window then each gives the same style of error:

$ which rails
/cygdrive/c/usr/lib/ruby/bin/rails
$ rails
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rails (LoadError)
$
$ which gem
/cygdrive/c/usr/lib/ruby/bin/gem
$ gem list
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/gem (LoadError)
$
$ which rake
/cygdrive/c/usr/lib/ruby/bin/rake
$ rake
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rake (LoadError)

I am not having this problem with anything else and so I am first asking
for help here since I expect the cygwin people will turn me to this
forum in the end in any case.

--
use.inject do |as, often| as.you_can - without end

James Byrne wrote:

In order to use git on my laptop (MS XPproSP3) I ended up installing the
cygwin environment. I tried MSysGit but it failed to run and the
maintainer was, shall we say, less than enthusiastic with my bug report.

Now, everything works from the standard windows dos box. However, when
I try and run a ruby utility such as gem, rake or rails from within the
cygwin bash shell window then each gives the same style of error:

$ which rails
/cygdrive/c/usr/lib/ruby/bin/rails
$ rails
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rails (LoadError)
$
$ which gem
/cygdrive/c/usr/lib/ruby/bin/gem
$ gem list
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/gem (LoadError)
$
$ which rake
/cygdrive/c/usr/lib/ruby/bin/rake
$ rake
c:\usr\lib\ruby\bin\ruby.exe: No such file or directory --
/cygdrive/c/usr/lib/r
uby/bin/rake (LoadError)

I am not having this problem with anything else and so I am first asking
for help here since I expect the cygwin people will turn me to this
forum in the end in any case.

Any insight anyone can provide me as to what is going on here would be
most appreciated.

I'm not on my Cygwin system at the moment; I can check it later today and give you a definitive answer. But it looks like your paths aren't right. The Ruby executable itself in a Cygwin prompt should show up as /usr/bin/ruby. If you type 'which ruby' from the prompt that's what you should see. And the libraries should be in /usr/lib/ruby/... .

What I would recommend is uninstalling everything and reinstalling rubygems from source. Then reinstall rails and its dependencies with "gem install".

In order to use git on my laptop (MS XPproSP3) I ended up installing the
cygwin environment. I tried MSysGit but it failed to run and the
maintainer was, shall we say, less than enthusiastic with my bug report.

I'm not sure if I understand. MSysGIT sounds like it would be
something from msys (ie. mingw). Why would you want to run a mingw git
from cygwin that has its own git?

cygwin has different path conventions that mingw or win32. I'd suggest
to run rxvt & bash.

It also seems slightly less than 100% optimal that you installed the
cygwin stuff to c:. IIRC the installer suggests c:\cygwin.

Thanks.

Yes, I have a previous windows only install of ruby and gem. I will
remove that and use the cygwin version and see how things shake out
after that.

···

--
Posted via http://www.ruby-forum.com/.

ThoML wrote:

In order to use git on my laptop (MS XPproSP3) I ended up installing the
cygwin environment. I tried MSysGit but it failed to run and the
maintainer was, shall we say, less than enthusiastic with my bug report.

I'm not sure if I understand. MSysGIT sounds like it would be
something from msys (ie. mingw). Why would you want to run a mingw git
from cygwin that has its own git?

I only installed the cygwin environment when it became obvious that the
MsysGiT maintainers were not interested in looking at my problem in the
near term, if ever. So the order of events was:

  Ruby on Windows => OK,
  Gem on Windows => OK,
  MSysGiT on Windows => FAIL,
  cygwin with GiT => OK,
  Gem on Windows => FAIL

It also seems slightly less than 100% optimal that you installed the
cygwin stuff to c:. IIRC the installer suggests c:\cygwin.

cygwin is installed in C:\cygwin

···

--
Posted via http://www.ruby-forum.com/\.

Robert Klemme wrote:

I am not having this problem with anything else and so I am first asking
for help here since I expect the cygwin people will turn me to this
forum in the end in any case.

I guess I will ask myself - this is long but complete :slight_smile:

If this is the wrong place to post this let me know.
I *have* looked about fairly extensively for some form of coherant and
coplete doc or howto but they are all vague and I have seen numerous
postings that others have problems. If I get it figured out I will post
my explicit cleaned up instructions somewhere so others with no ruby
experience whatsoever can repeat the process easily.

GOAL I want to get ruby and Rake up on cygwin. windows XP pro sp2 so I
can evaluate rake as the "make and ant" killer and maybe use it as our
primary cross platform build system. AND also to create an explicit set
of non-vague repeatable sitructions for others to do so.

I am following the "pickaxe book" bit on getting started.

**** So far

I downloaded and installed cygwin "fresh" as an administrator and
included the ruby package "1.8.7-p72-1". (latest)
the command ruby is found from the bash shell after installation.

~$ which ruby
/usr/bin/ruby

There is no RUBYOPT in my environment variables.

~$ echo X $RUBYOPT X
X X

from a cygwin bash shell.

~$ ruby
(now in ruby shell)
puts "xxx"
(control D)
xxx
~$

The interpreter seems to work.

I downloaded a copy of "OneClickInstall to get that version as a
reference and unpacked it so I could get the "samples", I did not run
it's ruby and removed it from the path it installed so as not to
conflict with cygwin. I also removed the RUBYOPT environment variable
it installed, closed and re-opened the bash shell to purge it's cache,
then:

~$ echo X $RUBYOPT X
X X

I found the "samples" directory from the one click install and found
eval.rb.

~$ cd /cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ls eval.*
/cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ls eval.*
eval.rb

from bash:

/cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ruby ./eval.rb
ruby: no such file to load -- ubygems (LoadError)

Ok I saw several places one had to install "rubygems" in "ths customary
way" ok so I guessed what the "customary way" is,
I downloaded. rubygems-0.8.11.zip
It unpacks to a directory ./rubygems-0.8.11/*

Ok where do I put it? in /usr/lib/rubygems-0.8.11 ??
I tried this
(this did not get rid of the load error)
I renamed to to /usr/lib/ruby
(this did not get rid of the load error)

where do I go from here:

(the objective here is to expand this into an explicit step by step set
of instructions for getting ruby and rake set up under cygwin-XP

a - so I can do it to evaluate rake as a "make and ant killer"
b - so others can repeat this process without needing to ask questions
    to set up their machines :slight_smile:

Peter K.

···

--
Posted via http://www.ruby-forum.com/\.

I removed the windows install of ruby and all the gems. I then
installed ruby from cygwin. I then downloaded rubygems-1.1.1.tgz from
rubyforge. I checked that the the path variables were correctly set and
that the same ruby executable was accessed from both the native cmd
window and the cygwin shell.

$ which ruby
/usr/bin/ruby

and

C:\DATA\DOWNLOAD\SOFTWARE\>which ruby
/usr/bin/ruby

I then expanded the tarball and made that directory the pwd. When I run
ruby setup.rb, in either the cmd window or the cygwin bash shell I see
this error:

BASH SHELL
byrnejb@HAL-M13
/cygdrive/c/DATA/DOWNLOAD/SOFTWARE/org.rubyforge/rubygems/rubyge
ms-1.1.1
$ ruby setup.rb
ruby: no such file to load -- ubygems (LoadError)

CMD WINDOWS SHELL
C:\DATA\DOWNLOAD\SOFTWARE\org.rubyforge\rubygems\rubygems-1.1.1>ruby
setup.rb
ruby: no such file to load -- ubygems (LoadError)

Any ideas as to what is going on?

···

--
Posted via http://www.ruby-forum.com/.

cygwin is installed in C:\cygwin

It didn't show up in your output which is why I suspected that you
mixed cygwin and non-cygwin apps which can cause troubles.

Replying with my own message.
OK - It seems (guesswork here) that one must unpack the runygems zip
file "anywhere" and then CD to it's root and do:

$ ruby ./setup.rb
And it executes a setup program, this succeeds.

Setup.rb however creates a directory called /usr/bin/ruby
so now in cygwin if I get:

$ ruby
bash: /usr/bin/ruby: is a directory

since /usr/bin is in the path.

How does one get around this?
Take /usr/bin out of the path?
always use "ruby.exe" explicitly?
Configure ruby to put its stuff somewhere else?

???

Peter Pk wrote:

···

Robert Klemme wrote:

I am not having this problem with anything else and so I am first asking
for help here since I expect the cygwin people will turn me to this
forum in the end in any case.

I guess I will ask myself - this is long but complete :slight_smile:

If this is the wrong place to post this let me know.
I *have* looked about fairly extensively for some form of coherant and
coplete doc or howto but they are all vague and I have seen numerous
postings that others have problems. If I get it figured out I will post
my explicit cleaned up instructions somewhere so others with no ruby
experience whatsoever can repeat the process easily.

GOAL I want to get ruby and Rake up on cygwin. windows XP pro sp2 so I
can evaluate rake as the "make and ant" killer and maybe use it as our
primary cross platform build system. AND also to create an explicit set
of non-vague repeatable sitructions for others to do so.

I am following the "pickaxe book" bit on getting started.

**** So far

I downloaded and installed cygwin "fresh" as an administrator and
included the ruby package "1.8.7-p72-1". (latest)
the command ruby is found from the bash shell after installation.

~$ which ruby
/usr/bin/ruby

There is no RUBYOPT in my environment variables.

~$ echo X $RUBYOPT X
X X

from a cygwin bash shell.

~$ ruby
(now in ruby shell)
puts "xxx"
(control D)
xxx
~$

The interpreter seems to work.

I downloaded a copy of "OneClickInstall to get that version as a
reference and unpacked it so I could get the "samples", I did not run
it's ruby and removed it from the path it installed so as not to
conflict with cygwin. I also removed the RUBYOPT environment variable
it installed, closed and re-opened the bash shell to purge it's cache,
then:

~$ echo X $RUBYOPT X
X X

I found the "samples" directory from the one click install and found
eval.rb.

~$ cd /cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ls eval.*
/cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ls eval.*
eval.rb

from bash:

/cygdrive/c/ruby/samples/RubySrc-1.8.6-p111/sample$ ruby ./eval.rb
ruby: no such file to load -- ubygems (LoadError)

Ok I saw several places one had to install "rubygems" in "ths customary
way" ok so I guessed what the "customary way" is,
I downloaded. rubygems-0.8.11.zip
It unpacks to a directory ./rubygems-0.8.11/*

Ok where do I put it? in /usr/lib/rubygems-0.8.11 ??
I tried this
(this did not get rid of the load error)
I renamed to to /usr/lib/ruby
(this did not get rid of the load error)

where do I go from here:

(the objective here is to expand this into an explicit step by step set
of instructions for getting ruby and rake set up under cygwin-XP

a - so I can do it to evaluate rake as a "make and ant killer"
b - so others can repeat this process without needing to ask questions
    to set up their machines :slight_smile:

Peter K.

--
Posted via http://www.ruby-forum.com/\.

Under a cygwin term, I had to 1st set:

  RUBYOPT=;export RUBYOPT

before installing rubygems with

$ ruby setup.rb

[Some installation output:

ruby setup.rb
install -c -m 0644 rbconfig/datadir.rb
/usr/local/lib/ruby/site_ruby/1.8/rbconfi
g/datadir.rb
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/rubygems
install -c -m 0644 rubygems/builder.rb
/usr/local/lib/ruby/site_ruby/1.8/rubygem
s/builder.rb
install -c -m 0644 rubygems/command.rb
/usr/local/lib/ruby/site_ruby/1.8/rubygem
s/command.rb
.... (MANY MORE LINES)

]

Best to you,
Bob

···

-----Original Message-----
From: byrnejb@harte-lyne.ca [mailto:byrnejb@harte-lyne.ca]
Sent: Thursday, June 12, 2008 11:48 AM
To: ruby-talk ML
Subject: Re: Help with Ruby under cygwin

I removed the windows install of ruby and all the gems. I then
installed ruby from cygwin. I then downloaded rubygems-1.1.1.tgz from
rubyforge. I checked that the the path variables were correctly set and
that the same ruby executable was accessed from both the native cmd
window and the cygwin shell.

$ which ruby
/usr/bin/ruby

and

C:\DATA\DOWNLOAD\SOFTWARE\>which ruby
/usr/bin/ruby

I then expanded the tarball and made that directory the pwd. When I run

ruby setup.rb, in either the cmd window or the cygwin bash shell I see
this error:

BASH SHELL
byrnejb@HAL-M13
/cygdrive/c/DATA/DOWNLOAD/SOFTWARE/org.rubyforge/rubygems/rubyge
ms-1.1.1
$ ruby setup.rb
ruby: no such file to load -- ubygems (LoadError)

CMD WINDOWS SHELL
C:\DATA\DOWNLOAD\SOFTWARE\org.rubyforge\rubygems\rubygems-1.1.1>ruby
setup.rb
ruby: no such file to load -- ubygems (LoadError)

Any ideas as to what is going on?

--
Posted via http://www.ruby-forum.com/.

more:

so a default install of cygwin produces mount locations as follows.

$ mount -m
mount -f -s -b "C:/cygwin/bin" "/usr/bin"
mount -f -s -b "C:/cygwin/lib" "/usr/lib"
mount -f -s -b "C:/cygwin" "/"
mount -f -s -b "C:/cygwin/home" "/home"
mount -s -b --change-cygdrive-prefix "/cygdrive"

Note /bin and /usr/bin are the same.

So somethign must be configured differently for it to work.
Any ideas?

Peter Pk wrote:

···

Replying with my own message.
OK - It seems (guesswork here) that one must unpack the runygems zip
file "anywhere" and then CD to it's root and do:

$ ruby ./setup.rb
And it executes a setup program, this succeeds.

Setup.rb however creates a directory called /usr/bin/ruby
so now in cygwin if I get:

$ ruby
bash: /usr/bin/ruby: is a directory

since /usr/bin is in the path.

How does one get around this?
Take /usr/bin out of the path?
always use "ruby.exe" explicitly?
Configure ruby to put its stuff somewhere else?

???

--
Posted via http://www.ruby-forum.com/\.

Setup.rb however creates a directory called /usr/bin/ruby
so now in cygwin if I get:

$ ruby
bash: /usr/bin/ruby: is a directory

I don't know what you have done here but it seems to me that you made
a mistake around step #1.

If you have windows ruby installed too, make sure its directory isn't
in your path before cygwin ruby and review any RUBY* environments
variables (unset RUBYOPT). Maybe also check $PATH so that no windows
commands with the same name as cygwin commands are used instead of
cygwin commands. Anything else should work smoothly.

Ehrick, Robert O wrote:

Under a cygwin term, I had to 1st set:

  RUBYOPT=;export RUBYOPT

before installing rubygems with

$ ruby setup.rb

Best to you,
Bob

Those were the magic words. Many thanks.

···

--
Posted via http://www.ruby-forum.com/\.

More: so it seems you have to set GEM_HOME to something else than the
default for the setup program which appears to be/usr/bin.ruby.

ie:

$ export GEM_HOME=/usr/local/lib/ruby
$ ruby ./setup.rb setup
...
$ ruby ./setup.rb install

This seems to put it in the right place anyway so that it doesn't
interfere with the /usr/bin/ruby.exe in the path. and creates
/usr/local/lib/ruby

I'm assuming after this you then need GEM_HOME to be set to run anything
with gems in it. ?

Peter Pk wrote:

···

more:

so a default install of cygwin produces mount locations as follows.

$ mount -m
mount -f -s -b "C:/cygwin/bin" "/usr/bin"
mount -f -s -b "C:/cygwin/lib" "/usr/lib"
mount -f -s -b "C:/cygwin" "/"
mount -f -s -b "C:/cygwin/home" "/home"
mount -s -b --change-cygdrive-prefix "/cygdrive"

Note /bin and /usr/bin are the same.

So somethign must be configured differently for it to work.
Any ideas?

--
Posted via http://www.ruby-forum.com/\.

I deliberately removed GEM_HOME and tried it again and it still
installed in /usr/bin/ruby

When I explicitly set it to /usr/local/lib it went into the right place.
It is possible that the setup.rb cached the prior GEM_HOME when it did
it's "configure" phase.

So it seems the only reliable way to make an explicit, accurate,
installation script is to explicity define GEM_HOME as part of the
procedure. Since "setup" isn't explicitly asking for the items and/or
showing the current settings and asking "Y" or "N" to continue. ie: like
a debian install script.

toomln wrote:

···

Setup.rb however creates a directory called /usr/bin/ruby
so now in cygwin if I get:

�$ ruby
bash: /usr/bin/ruby: is a directory

I don't know what you have done here but it seems to me that you made
a mistake around step #1.

If you have windows ruby installed too, make sure its directory isn't
in your path before cygwin ruby and review any RUBY* environments
variables (unset RUBYOPT). Maybe also check $PATH so that no windows
commands with the same name as cygwin commands are used instead of
cygwin commands. Anything else should work smoothly.

--
Posted via http://www.ruby-forum.com/\.

synopsis which I wish I had found earlier :slight_smile:

HOWTO: install cygwin with ruby, rubygems, and rake on windows XP
how to install cygwin with ruby, rubygems, and rake on windows XP

Download and install cygwin and make sure the "ruby" package is
selected.

make sure the RUBYOPTS environment variable is empty or unset

Download and unpack the rubygems distribution zip or tar file into a
temporary area.

set GEM_HOME=/usr/local/lib/ruby in the system environment variables

In the cygwin bash shell cd to the root of what you unpacked.
execute these commands:

$ ruby ./setup.rb config
$ ruby ./setup.rb setup
$ ruby ./setup.rb install

set RUBYOPTS=rubyopts in system environment variables

Gems is now installed on cygwin ruby.
Now you can install rake

Download and unpack the rake distribution .zip or .tar file into a temp
area.
In the cygwin bash shell cd to the root of what you unpacked.
execute this command:

$ ruby ./setup.rb

Rake should now be installed.

PK

···

--
Posted via http://www.ruby-forum.com/.

Sorry I can't be of much more help. Two quick thoughts:

i) Is there any reason you want to use rubygems 0.8.11 ? The current
version is 1.2.0 : http://rubyforge.org/frs/?group_id=126

ii) If you want a simple install of ruby for you and your colleagues
to use (principally with rake in mind), could you not just use the one-
click installer ? (http://rubyinstaller.rubyforge.org/wiki/wiki.pl) I
think it comes with rake, and several other gems, pre-installed.

Chris

Gems is now installed on cygwin ruby.
Now you can install rake

Download and unpack the rake distribution .zip or .tar file into a temp
area.
In the cygwin bash shell cd to the root of what you unpacked.
execute this command:

Is it not possible to do
   gem install rake

now that you have rubygems installed ?

Chris

i) ooops - I must have used a stale link somewhere :slight_smile:
   my problems could all have been fixed bugs !!!
Thanks for the slap !

ii) we use cygwin so we have a similar environment on the 'nix boxes and
XP Pcs. and have been using gnu-make for some old scripts, and have
bash and perl scripts and the like that run on both, we also use
open-ssh scp rsync wget etc. the path difference between the two
complicates things. My plan was to test both.

It seems like packaging everything for a "one command" cygwin/ruby
install (unzip this to temp, do "bash ruby ./setup.rb" is a fairly easy
way. I already have a pre-downloaded maintained .zip of cygwin that is
"install from local directory" ready.

Chris Lowis wrote:

···

Sorry I can't be of much more help. Two quick thoughts:

i) Is there any reason you want to use rubygems 0.8.11 ? The current
version is 1.2.0 : http://rubyforge.org/frs/?group_id=126

ii) If you want a simple install of ruby for you and your colleagues
to use (principally with rake in mind), could you not just use the one-
click installer ? (http://rubyinstaller.rubyforge.org/wiki/wiki.pl\) I
think it comes with rake, and several other gems, pre-installed.

Chris

--
Posted via http://www.ruby-forum.com/\.