Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to make rubyinstaller play nice with cygwin?

I was having trouble getting jekyll to work with Ruby using cygwin on Windows 7 64-bit. I had better results using rubyinstaller + devkit. It would be really nice if I could use the rubyinstaller ruby inside of cygwin.

However, I get the following message when I try to execute rake.

$ rake page name="pages/about.md"
C:\Ruby193\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby193/bin/rake (LoadError)

Is there any way to make rubyinstaller play nice with cygwin?

like image 654
Devin Snyder Avatar asked Sep 03 '12 17:09

Devin Snyder


2 Answers

I just put a few of these in my .bash_profile:

alias gem=gem.bat
alias irb=irb.bat
alias rake=rake.bat

I never have any of the problems that Luis mentions.

like image 67
pguardiario Avatar answered Nov 15 '22 15:11

pguardiario


The problem is cygwin converting all the scripts paths into cygwin paths (/cygdrive/...).

There is no solution for that since the invoke of the script is made from bash over rake scrip which invokes native Ruby.

There are a lot of other issues that cygwin will cause, and some are covered in RubyInstaller troubleshooting page

One alternative will be invoking rake.bat directly, skipping cygwin shebang detection.

But cygwin doesn't like batch files, which forces you to do cmd.exe /C rake.bat and that is a noisy command line.

The other alternative is install something like gem-exefy (gem install gem-exefy) and generate executables for your installed gems (rake.exe).

That way you invoke rake.exe instead of letting cygwin figure it out.

Another alternative is use MSYS Bash (included in DevKit) instead of cygwin, which plays way better than cygwin one, but you will still have issues with batch files.

As you can see, mixing non-native (cygwin) with native (RubyInstaller) have a lot of side-effects.

like image 43
Luis Lavena Avatar answered Nov 15 '22 16:11

Luis Lavena