4

I have been stuck on this issue for a couple hours now and I cannot find a solution. I am running Mavericks and have Xcode 5.0.2 installed (which comes with the Command Line Tools).

My environment:

  • using RVM with ruby version 1.9.3p484
  • Xcode 5.0.2
  • Mac OS 10.9.1
  • Gem 2.2.0
  • Bundler version 1.3.5

Sudo gem install cocoapods outputs

kyles-mbp-2:fresh-driver-ios kylechronis$ sudo gem install cocoapods
     Building native extensions.  This could take a while...
     ERROR:  Error installing cocoapods:
     ERROR: Failed to build gem native extension.

    /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -rubygems    
    /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/gems/rake- 0.9.2.2/bin/rake RUBYARCHDIR=/Users/kylechronis/.rvm/rubies/ruby-1.9.3- p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/xcodeproj-0.14.1 RUBYLIBDIR=/Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-13/1.9.1/xcodeproj-0.14.1

   /Users/kylechronis/.rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb
   checking for -std=c99 option to compiler... yes
   checking for CoreFoundation... no
   checking for main() in -lCoreFoundation... no
   CoreFoundation is needed to build the Xcodeproj C extension.
    *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of
   necessary libraries and/or headers.  Check the mkmf.log file for more
   details.  You may need configuration options.

Is this an issue with CoreFoundation not being found? or using a different version of Ruby? Any help or input would be greatly appreciated.

4 Answers 4

19

Installing new Ruby version helped me. Follow these steps

rvm reinstall ruby-2.0.0-p247 --with-gcc=clang --verify-downloads 1
gem install xcodeproj
gem install cocoapods

I found this answer in some old Github issue.

Sign up to request clarification or add additional context in comments.

4 Comments

this was the fix for me, although I backdated myself from 1.9.3-p484 to 1.9.3-p448 . Seems like something is messed up with the p484 build in this scenario.
this fixed it for me too with xcode 5.0.2, it wasn't working with ruby 1.9.2-p442
use sudo gem install cocoapods if you want to be able to use cocoapods from within any directory on your system.. the above command only makes it work on the same directory it was installed FYI, this is also in accordance with the installation instructions on the cocoapods website
Worked with 2.1.1 also
2

I ran into this:

http://cocoafactory.com/blog/2013/02/01/troubleshooting-cocoapods-installation/

and this:

http://railsapps.github.io/installrubyonrails-mac.html

I kinda figured i needed to update something since I was in 1.9.3 i tried updating to 2.1.0. Then I realized I couldn't by doing rvm install ruby. So I did

sudo gem update --system

that did something which worked, then I was able to run

rvm install ruby which updated successfully to 2.1.0

Reinstalled cocoa pods btw...and now

pod setup has given me Setting up Cocoadpods master repo :)

Comments

0

http://railsapps.github.io/installrubyonrails-mac.html

and this :

rvm get stable --auto-dotfiles

did the trick

Comments

0

i had the identical error messages and spent a lot of time trying all the various answers above and on other sites and other SO pages including:

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

and

http://www.relaxdiego.com/2012/02/using-gcc-when-xcode-43-is-installed.html

and many others

none of it made any difference

i ultimately created a new user on my iMac to see if i could install cocoapods successfully on a pristine install, and it worked beautifully. i checked all the various versions of everything (ruby, gcc) and found they were the same for the new user as for my old user.

then i realized there were some extra lines added in my ~/.bashrc and ~/.bash_profile files that were there to help set up virtualenv as follows:

in .bashrc:

export WORKON_HOME=$HOME/.virtualenvs 
export PROJECT_HOME=$HOME/Desktop/Programming
source /usr/local/bin/virtualenvwrapper.sh

and in .bash_profile:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 

after commenting these lines out and sourcing .bashrc and .bash_profile

$ source ~/.bashrc
$ source ~/.bash_profile

then

$ sudo gem install cocoapods 

worked flawlessly...

hope this helps someone else in my previously hopeless situation

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.