Not sure what happened but when I upgraded to Mavericks it says that Rails it not install. I executed the following command:
rails --version
I think I had the same issues. I updated the xcode and open xcode to accept licence aggrement. Then it worked fine as far as I can remember.