After you've done the steps below it will be as if you did an upgrade rather than a clean install. Your home directory will be there, as will your applications.
- Back up system to an external HD (I used Super Duper)
- Install mountain lion clean: http://eggfreckles.net/notes/installing-mountain-lion-clean/
- At the end of the install, transfer files back from my external HD
- Remove everything in /usr/local with sudo rm -Rf /usr/local/*
- Follow these instructions: http://jfire.io/blog/2012/03/02/xcode-4-dot-3-homebrew-and-ruby/
- I had trouble with ree/1.8.7 so I had to follow these instructions: http://stackoverflow.com/questions/11664835/mountain-lion-rvm-install-1-8-7-x11-error/11666019#11666019