Tuesday, May 24, 2011

"LoadError: no such file to load -- firewatir" issues running firewatir in irb

i kept hitting "LoadError: no such file to load -- firewatir" when i'd call firewatir AND rubygems in irb. ends up my ruby + gems were a hot mess! i had multiple copies in different places and the last thing i wanted to do was symlink 'em together b/c i knew it would bite me in the ass later so i did some extensive googling an found lots of good info that i'll summarize for you below...

first fix your ruby setup!

this is what i was seeing before:
$ which -a ruby
/usr/bin/ruby
/opt/local/bin/ruby

this is where it's supposed to be:
$ which -a ruby
/usr/local/bin/ruby

i wiped out these two ruby dirs as well was the gems + irb libs/dirs:
$ sudo rm -rf /usr/bin/ruby
$ sudo rm -rf /usr/local/bin/rub
$ sudo rm -rf /usr/local/lib/ruby
$ sudo rm -rf /usr/lib/libruby*
$ sudo rm -rf /usr/lib/libsvn_swig_ruby*
$ sudo rm -rf /usr/lib/ruby*
$ sudo rm -rf /usr/bin/irb
$ sudo rm -rf /opt/local/bin/irb
$ sudo rm -rf /usr/bin/gem

i downloaded + installed:
RubyOSX-1.8.7-p172-INTEL_Leopard.pkg.zip

then did this to verify that my latest ruby version was installed in the correct spot:
$ which -a ruby
/usr/local/bin/ruby

next, i went out and downloaded all the gems i needed...
$ sudo gem update --system
$ sudo gem install cucumber
$ sudo gem install firewatir
$ sudo gem install watir-webdriver
$ sudo gem install rcov
$ sudo gem install capistrano
$ sudo gem install capistrano-ext
$ sudo gem install mocha
$ sudo gem install ruby-debug
$ sudo gem install mongrel

i fired up irb and the "LoadError: no such file to load -- firewatir" errors were gone, but i was still having issues launching firewatir due to jssh not initializing properly. ends up all i have to do is call this before calling firewatir:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -jssh
(thanks for the hint stackoverflow!)

No comments:

Post a Comment