Archive for February, 2012

Running Ruby 1.8.7 and 1.9.2, RVM 1.10.3, OS X 10.7.3 and Xcode 4.3

February 24th, 2012

I recently updated to OS X 10.7.3 and RVM 1.10.3. The OS X update seems to have confused rvm by changing to a different compiler, resulting in ‘rvm install’ falling with this error:

The provided compiler ‘/usr/bin/gcc’ is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

The solution that worked for me to install 1.8.7 was to tell rvm which compiler to use:

CC=/usr/bin/gcc-4.2 rvm install 1.8.7

This worked as expected.

However, trying to install 1.9.2 or above using the same method failed. So, i tried reinstalling Xcode, to no-avail. I then uninstalled Xcode devtools (sudo /Developer/Library/uninstall-devtools) and installed osx-gcc-installer. After this, i was able to install 1.9.2 using ‘CC=/usr/bin/gcc rvm install 1.9.2′, but it reported errors

Ruby ‘ruby-1.9.2-p290′ was build using clang – but it’s not (fully) supported, expect errors

Let’s see how well this works out. If i get errors, there must be a different compiler i can force rvm to use.

Well, the lack of Xcode devtools resulted in this error when Installing rmagick (2.13.1) with native extensions:

checking for stdint.h… *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

So, i re-installed devtools and tried again. Let’s see how well this works.

Update

1.9.2 is working fine, but 1.8.7 is raising this error:

~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault

Time to investigate what’s going on here!

1. rvm uninstall 1.8.7 && CC=/usr/bin/gcc-4.2 rvm install 1.8.7

Same error: ~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault

2. rvm uninstall 1.8.7 && CC=/usr/bin/gcc-4.2 rvm install ruby-1.8.7 –force

Same error: ~/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault

3. rvm install ree

Worked!

So, it seems that this setup requires ree

Debugging cucumber scenarios in Rubymine

February 1st, 2012

Debugging cucumber scenarios in Rubymine is wonderfully simple. Here’s how i do it:

Create a cucumber step that puts the app into debug mode and pops open the current page that’s being debugged

Screen Shot 2012-02-01 at 16.00.42

I use Rubymine’s gutter breakpoints, and I add the breakpoint after the save_and_open_page method call, so the page pops open before entering the debugger.

Insert the step into whichever scenario i wish to debug

Screen Shot 2012-02-01 at 15.43.25

Run the scenario in debug mode

Screen Shot 2012-02-01 at 15.48.36

Inspect the app’s objects in Rubymine’s Watches

Screen Shot 2012-02-01 at 15.36.27

Pretty sweet! Super easy and extremely useful.

Rubymine’s a great app, and i’m just starting to scratch the surface.