Install XCode command-line tools. Available from the Preferences > Download panel in XCode, or as a separate download from the Apple Developer site.
Install gcc-4.2. Ruby versions before 1.9 (such as 1.8.7 or REE) do not play well with Apple’s LLVM compiler, so you’ll need to install the old gcc-4.2 compiler. It’s available in the homebrew homebrew/dupes repository.
Install xquartz. The OS X upgrade will also remove your old X11.app installation, so go grab xquartz from http://xquartz.macosforge.org/landing/ and install it (you’ll need v2.7.2 or later for Mountain Lion).
Install Ruby 1.9. This one is simple.
Install Ruby 1.8.7. Remember to add the path to the xquartz X11 includes in CPPFLAGS. Here I’m using rbenv, but the same environment variables should work for rvm.
Install ree. Remember to add the path to the xquartz X11 includes in CPPFLAGS and the path to gcc-42 in CC. Here I’m using rbenv, but the same environment variables should work for rvm.
Enjoy your new Ruby versions