ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension


You need to install Xcode's developer tools. The easiest way to do this is through terminal (this question)

xcode-select --install

I fixed the problem by using ruby 2.0 (which is the preferred way on mavericks) or greater. In case you are using rvm just change to the correct ruby with:

rvm use ruby-2.0

After that gem install cocoapods worked correctly. To be more specific, I was using:

OSX 10.9.2

First as wrote "Kevin" try to run in terminal:

xcode-select --install

If it doesn't help you download tools manually from apple developer site:

It helped me.

I fix the problem by follow step:

1:rvm install 2.0.0

2:rvm list * ruby-1.9.3-p545 [ x86_64 ] => ruby-2.0.0-p451 [ x86_64 ]

3:rvm 2.0.0 —default

4:pod update

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.


I had the same issue. Tried to install pods to my project but never worked out. I updated Xcode, Updated Command Line tools, reinstalled cocoapods... almost everything.

Sitting on my ass , writing pod in terminal showed up a screen listing available commands.

I read all of them and noticed the command

pod setup

which does

+ setup               Setup the CocoaPods environment

After this line of code, my problem was fixed.

I hope my solution help other people in trouble like me.

I had multiple environments in my configuration, which was causing problems as rvm was interfering with the installation. Once ruby 2.x was detected the install went fine.

For my environment I did the following: 1. xcode-select --install 2. rvm implode (Note - too drastic - you may not need to do this, I didn't have any use for the older ruby installations, I removed them via rvm uninstall one-by-one and then used rvm implode 3. gem install cocoapods

This time the last command worked without any issues.

I was getting this error and had to completely reinstall cocoapods to fix it. Finally worked. Maybe this solution suits for anyone else.

sudo rm -rf home_folder/.cocoapods/

After that, did again

pod setup

and installed my libraries from zero, and everything worked.

Hope it helps!


You must use the command in Terminal for installing Command Line Tools:

xcode-select --install

If you receive the message as a result of "Can't install the software because it is not currently available from the Software Update server.", You must download manually Command Line Tools from Apple site.