Cocoapods with Xcode 6 and 10.10 Yosemite

After initially upgrading to 10.10 and XCode6-Beta, I tried to run 'pod update' and I received this error:

cannot load such file -- xcodeproj/prebuilt/universal.x86_64-darwin14-2.0.0/xcodeproj_ext (LoadError)

I tried to update Cocoapods using 'sudo gem install cocoapods', but received another error:

Fetching: xcodeproj-0.17.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing cocoapods:
ERROR: Failed to build gem native extension.

"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby" -rubygems /Library/Ruby/Gems/2.0.0/gems/rake-10.1.1/bin/rake RUBYARCHDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext RUBYLIBDIR=/Library/Ruby/Gems/2.0.0/gems/xcodeproj-0.17.0/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for -std=c99 option to compiler... *** 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.

Has anyone else been able to successfully use Cocoapods with Xcode 6 on 10.10 Yosemite?


Solution 1:

  1. Open Xcode 6
  2. Open Preferences
  3. Click the Locations tab
  4. Change the Command Line Tools version to Xcode 6.0
  5. Uninstall cocoapods
    $ sudo gem uninstall cocoapods
  6. Uninstall xcodeproj $ sudo gem uninstall xcodeproj
  7. Install xcodeproj
    $ sudo gem install xcodeproj
  8. Install cocoapods
    $ sudo gem install cocoapods
  9. Run pod --version to verify that it worked

Solution 2:

// Running Xcode6-Beta7 on 10.10 (14A343f)

I have tried all of the above and didn't have any luck. Here's what worked for me:

I installed the latest version of Ruby via Homebrew (took a few minutes)

brew install ruby

then installed Cocoapods as usual

sudo gem install cocoapods

and it worked a treat!