I am trying to install cocoapods to my MacBook Pro running with OSX 10.9.1 (new Mavericks) and after type gem install cocoapods I get the following error:
gem install cocoapods
I was having the same exact problem, although I had the latest version of the xcode command-line tools.
If you have homebrew installed, do brew install apple-gcc42. This immediately solved it for me.
brew install apple-gcc42