Most people need to do this only when they get a new system. I had to go through this to help out a potential brogrammer, and it would have been much easier if I pointed him to one place where he could just following direction. Instruction here applies to Mac OS X 10.6.x.
1. Install Xcode
Xcode is included in the Mac OS X install disc. You can install from the DVD or you can down load it from here,
http://developer.apple.com/xcode/.
2. Install RubyGems if not already installed
Doing the following command in terminal and see if it returns version number. If not, follow the link below to install RubyGems.
gem -v