These days Xcode is getting installed directly from Mac App Store. For installation of Ruby on Mac OS X we need a C compiler. It used to be installed with Xcode in previous versions. In Xcode 4.3 that needs to be installed from Preferences of Xcode in the Downloads section, the "Command Line Tools" bit. When you click [Install] button you will be asked for your Apple Developer ID you have registered with as Apple Developer. I have put a wrong AppleID and I could not find where to change it in Xcode preferences. But because Xcode asked me if I want to store this information in my Keychain, I could find that in the keychain under daw2.apple.com name. This way Xcode will ask for Apple Developer ID again.

So far so good, the 171.7MB of Command Lind Tools are downloading, although the note under that installation explains that those are not really necessary:

Before installing, note that from within Terminal you can use the XCRUN tool to launch compilers and other tools embedded within the Xcode application. Use the XCODE-SELECT tool to define which version of Xcode is active.  Type "man xcrun" from within Terminal to find out more.

Downloading this package will install copies of the core command line tools and system headers into system folders, including the LLVM compiler, linker, and build tools.


If you want to use the compiler without installing the "Command Line Tools" you need first to set the path to Xcode. Run that as super user:  
> sudo xcode-select -switch /Applications/Xcode.app/
This way you can find where is the compiler:  
> xcrun -find cc  
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
> xcrun -find gcc  /Applications/Xcode.app/Contents/Developer/usr/bin/gcc

All the above came from that I wanted to install Ruby 1.9.3 on Mac OS X 10.7.3 Lion using rvm:
> rvm install 1.9.3
The above command will fail as it needs to use another compiler. Thanks to zzaman who answered to similar problem on Stack Overflow I have specified the compiler, which works:
> rvm install 1.9.3 --with-gcc=clang



Now I have 1.9.3-p0 under rvm 1.10.2 and another problem. Setting a default gemset is not working. 
> rvm use 1.9.3@3.2 --default

But with help from ashleyconnor the suggestion to get the head version of rvm helped. Now with rvm 1.10.3 the default gemset is working. This resulted also in getting Ruby 1.9.3-p125. Here we are with:
> ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
> rails -v
Rails 3.2.2