1 min read

ParseTree in Cygwin

So I had a recent need to get parse_tree (which requires RubyInline and thus a compiler) working in Windows. I was told that I could get it working by using some compiler for Windows, but I figured it might be easier to get it working in Cygwin.

That turned out to be only sort of true.

First up, I installed Cygwin with Ruby. I attempted to use irb, and got cannot find ubygems. Googling around led to me to the following solution:

$ unset RUBYOPT

I then needed to install rubygems from scratch, so I grabbed it into my home directory:

$ wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz

Unpacked it:

$ tar -xvf rubygems-0.9.4.tgz

Got into the directory, and installed rubygems:

$ cd rubygems-0.9.4
$ ruby setup.rb

I then installed parsetree:

$ gem install parsetree -y

It installed a bunch of dependencies, including RubyInline. So far so good.

When I attempted to load parse_tree from IRB, I got an error about permissions. After a bunch of searching around, I found the answer: make sure the /cygdrive/c directory is not group or world-writable. The easiest solution is:

$ chmod 700 /cygdrive/c

If you have special needs, you might need to tweak up the chmod command, but you need to keep it from being group or world writable.

And that was it. I loaded IRB and parse_tree worked great!