views:

36

answers:

1

I am a Ruby programmer on Windows who trys to switch from Win cmd to Cygwin, but cannot achieve to execute batch files of Ruby gems.

I already stuffed any bin directory into the Windows PATH env. variable, including the Ruby bin where the executables are stored. Gems, however, are invoked by ruby.exe itself, which leads to the following problem with POSIX paths:

duddle@duddledan /cygdrive/c/Ruby/ruby-186-398/bin
$ gem -v
C:\Ruby\ruby-186-398\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby/ruby-186-398/bin/gem (LoadError)

duddle@duddledan /cygdrive/c/Ruby/ruby-186-398/bin
$ ./gem --version
1.3.7

When calling e.g. ./gem directly by specifying the path, it can be found and executed.

Any ideas?

Edit:

How to tell cygwin not to process batch files?

A: 

You're trying to mix batch files which expect native paths with Cygwin, which completely dislike it.

When you call ./gem you're invoking the ruby script, but using the PATH is invoking the batch file.

Either you tell cygwin not to process batch files (dunno how) or you use MSYS Bash if you want a replacement of cmd.exe, but don't mix Cygwin with native Ruby.

I've blogged about mixing and matching in the past:

http://blog.mmediasys.com/2008/10/27/handy-tip-dont-mix-one-click-installer-with-cygwin/

Luis Lavena
Ok... reading your blogpost... how would I use the bundled Ruby version of Cygwin... and what would be the disadvantages of doing so? Can/Must I also install all other tools relying on native extensions within the Cygwin environment? ImageMagick, nokogiri, etc, etc.? Does that slow things down? Or will I encounter other problems?
duddle
Yes, it will be slower and yes, you will need to install everything under cygwin Ruby because compiled code is different.
Luis Lavena
A recommendation is use MSYS, because if you only need bash, then you don't need the slowness of cygwin in everything.
Luis Lavena