On Leopard, after using the path-setting.rb script, Gem.path contains /System/Library/Frameworks/Ruby.framework/… and /path/to/RubyCocoa.app/Contents/Resources/third-party/gems as expected. On Snow Leopard, Gem.path contains the user’s .gem folder, /Library/Ruby/Gems, then the two folders above.
Unfortunately I don’t know enough about RubyGems yet to understand what the script is doing. However, I’ll share how I found the problem and what it might mean.
My rubycocoa app uses a gem called nokogiri that compiles at install. On Leopard the bundle has both ppc and i386 architectures; on Snow Leopard the bundle is x86_64 only, because ruby runs as 64 bit. For the gem included in the app bundle I compiled it with all 3 architectures.
The app crashes on launch because it can’t find the right architecture for the gem, which is how I found it was using the gem in /Library instead of the app bundle. But it also means that the rubycocoa app is running as 32 bit (which Activity Monitor shows). I wonder why?