RoR setup instructions: I guess you already have XCode on your machine.
In general: avoid sudo where you can, with this setup you can install and run everything without sudo
http://mxcl.github.com/homebrew/
here is a list of the packages on my machine