Search code examples
rubymacosrubygemsmacportsfxruby

Installed fxruby over macports, now rubygems is broken


I installed fxruby using

$sudo port install rb-fxruby

As suggested in the book.

It works, my hello world program worked correctly.

Now, though, other code that I have written is broken, whenever I try to use any code that relies on a gem, it does not work. When I do $ruby -e "require 'rubygems'" in my code, it gives

"LoadError: no such file to load — rubygems" 

When I set my RUBYOPT="rubygems" in my .bash_profile

$ruby -e "puts 'hello world'"
ruby: no such file to load -- ubygems (LoadError)

(it says 'ubygems' without the 'r' on the front, not sure why)

http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.ruby/2008-08/msg00351.html suggests I check my gem location against my ruby location, I get:

$cat `which gem` | head -n 1
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

$ls -l `which ruby`
-rwxr-xr-x  2 root  admin  12680 Feb  7 03:40 /opt/local/bin/ruby

I assume this means that the gems are confused, but not sure how to remedy it. Any ideas? It sucks not having gems.

---UPDATE---

Forgot to list versions:

$which gem
/usr/bin/gem

$gem --version
1.3.5

$ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9]

Solution

  • If you installed rb-fxruby via macport it will install the macport ruby as well.

    $ port info rb-fxruby
    ...
    Library Dependencies: ruby, fox, fxscintilla
    ...
    

    But as you can see rb-rubygems (the macport version of rubygems) is not listed as a dependency, so you will have to install it manually.

    $ sudo port install rb-rubygems
    

    should do it for you.