The compiler failed to generate an executable file. (RuntimeError) The compiler failed to generate an executable file. (RuntimeError) xcode xcode

The compiler failed to generate an executable file. (RuntimeError)


Same problem occurred and I finally solved it. Here are the steps I followed:

  • Xcode, Xcode CLT
  • sudo xcodebuild -license
  • sudo port upgrade outdated
  • sudo port install apple-gcc42
  • rvm reinstall 1.9.3 #important!

Really, I think just first,second and last steps required, but can not test it.


Be sure to open XCode after updates. I found that I had to open it and accept the new license agreement after a recent update of XCode via the App Store. Otherwise I received the "The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first."


If you're using rbenv and homebrew:

brew tap homebrew/dupes ; brew install apple-gcc42