Everything is rocking along just fine: I've got Cucumber and RSpec running and working my way thru "The RSpec Book" (pretty useful so far). However, I needed to install FXruby so that I could do some graphical work and figured this would be no problem. Turned out to be a little tricky and I had to remember an issue I ran into a while back on a Linux system.
First off, this won't work:
gem install fxrubyIt'll install that gem alright, but that's not enough to get things running: you have to get Fox installed as well and that doesn't come along with the gem.
Of course, to do that, you have to install MacPorts which is actually relatively painless (see the MacPorts Guide for how to do this).
Once you've done this, then you can install the complete FXRuby collection of stuff (see the FXRuby Book at PragProg.com)...
sudo port install rb-fxrubyand it's a very large collection indeed: it took over 1 hour on my machine.
The only hitch I ran into was having too old a version of the Mac XTools package, so that was another 800Megs of download and an install. If you do this make sure you get the right version: XTools 3.1 is for OS X 10.5 and XTools 3.2 is for 10.6. Check this first or you'll spend most of an hour installing fxruby only to have it complain about the wrong XTools version and you'll have to start over.
MacPorts updates your ~/.profile or ~/.bash_profile file (note that the MacPorts install docs only mention ~/.profile and I had to dig a bit to find that they had properly modified my ~/.bash_profile file) so that your system can find the added programs...
But that's not quite everything you have to do and here was the gotcha for me. Even after I went through all this, I kept getting strange messages out of my test runs, things like:
"unable to load file ubygems"(the missing 'r' is not a typo: that was the exact error message) when executing the "require 'rubygems'" statement.
I tried adding the command:
export RUBYOPT=rubygemsto my profile so that I wouldn't have to add a require 'rubygems' statement but that didn't solve the problem.
BTW, when I went to the RubyGems Guide, they said to use the -rubygems option on the ruby command line, but that also generated the same error.
After a little more digging, I found the problem: MacPorts installs everything in /opt/local, which is not where the normal gem command installs things (if you do a simple "gem install
The solution? Install rubygems using MacPorts so that my FXRuby could find what it needed. That was a simple:
sudo port install rb-rubygemsand now my ruby apps would run again, load the gems, and I had a simple FXRuby app running.
Quite frankly, I'm not sure of all the nitty-gritty details of this problem and I'm not even sure that I won't have further problems downstream when I want to use another gem, but I'll face that problem when I come to it. If anyone has a definitive answer as to WHY this happened and a better approach to Mac OS X gem installation, I'm all ears.