Search code examples
rubywindowscygwinrake

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?


Solution

  • 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.