Take the 2-minute tour ×

I replaced a broken logic board on my MacBook Pro and have OS X Snow Leopard reinstalled without XCode.

I installed gems successfully without running into any errors, but when I tried installing rails it gives me an error:

Error: failed to build gem native extension.

I searched on the web and Stack Overflow guided me to upgrade to OS X Lion. I installed the Lion compatible Xcode 4.3, then installed the command line tools.

Now Rails installed just fine.

I thought Xcode is just an IDE. Why does it have anything to do with Rails?

share|improve this question
add comment

1 Answer

From: Don’t be terrified of building native extensions! - Pat Shaughnessy

The native extension is some C code that’s included inside the Ruby gem that calls the external component’s API, converting the parameters and return values between the format the external library needs and what the Ruby interpreter expects.

The Xcode installer package contains all the developer tools for OS X. Without Xcode installed, you don't have a C/C++/Objective-C compiler installed. When you install Xcode, it installs GCC and Clang-LLVM, and many other developer tools, including most of the GNU toolchain, make, etc.

share|improve this answer
I added a link to an article that explains why Rails really would need Xcode. Hope you don't mind. –  slhck Jul 17 '12 at 11:15
add comment

Your Answer


