UPDATE 2 (update 1 at the bottom with some extra ruby version info)
When you install Xcode make sure is is the latest version. I must have at some point installed the old Leopard version. then when things did not work reinstalled that same old version. I found xcode321_10m2003 in my downloads folder not the older one I had put in a software folder. You may still need to update Ruby to a new version.
Make sure you have the latest Xcode.
I have been trying to get the very simple Sinatra (a light ruby on Rails) setup working following the verysimple instructions on
http://www.sinatrarb.com/Make a file called hi.rb with this inside:
require 'rubygems'
require 'sinatra'
get '/hi' do
"Hello World!"
end
Then run these commands:
$ gems install sinatra
$ ruby hi.rb
They fail with:
hi.rb:2:in `require': no such file to load -- rubygems (LoadError)
from hi.rb:2
After removing the require 'rubygems', is it actually still required ?
hi.rb:3:in `require': no such file to load -- sinatra (LoadError)
from hi.rb:3
To fix this I ran through the instructions at
http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/Their instructions worked well until the mysql gem which I do not require at the moment but do like to get my set up the same as the tutorial. I found the following line on stackoverflow.
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysqlplus
Finally got the basic sinatra working by calling:
$ /usr/local/bin/ruby hi.rb
Even though which ruby returns /usr/local/bin/ruby, so why does ruby hi.rb not just work!
What is going on just thought I would check to see if calling the other ruby breaks it, but it works fine.
$ /usr/bin/ruby hi.rb
UPDATE
For completeness and to answer Spyro7's Question:
$ /usr/local/bin/ruby -v
> ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.2.0]
$ /usr/bin/ruby -v
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]