Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRashii Henry
16,433 PointsError Installing Cocoapods
whenever i run the command:
sudo gem install cocoapods
i run across the following error message:
ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.
im new to cocoapods so could anyone assist me? I'm running OSX version 10.9.2
7 Answers
Rashii Henry
16,433 PointsI found a solution to my problem. after running : sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
cocoapods installed successfully.
Patrick Donahue
9,523 PointsTry this Stack Overflow answer.
Rashii Henry
16,433 Pointsfrom that stack overflow answer i've already updated my command line tools. are you suggesting that i install homebrew and run the command :
brew install apple-gcc42
Patrick Donahue
9,523 PointsIt seems like you may not have Ruby installed.
Rashii Henry
16,433 Pointsi do have ruby installed. check what i put under Amit's answer.
Amit Bijlani
Treehouse Guest TeacherHere's a checklist that might help:
- Do you have multiple versions of Ruby? Do you have rvm or rbenv installed? If so, you have to make sure you are installing the CocoaPod gem to the right version.
- Do you have the latest version of Xcode?
- Do you have multiple versions of Xcode? If you do, then use the xcode-select to select the latest version of Xcode.
- Finally, here's another workaround that helped others: https://gist.github.com/goshakkk/5763489
Rashii Henry
16,433 PointsHere's my output when i run the command ruby -v: ichange-lives:~ rashiihenry$ ruby -v ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0] ichange-lives:~ rashiihenry$
i'm currently running the latest version Xcode version 5.1.
Amit Bijlani
Treehouse Guest TeacherMake sure you have Xcode Command Line tools installed: https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-
Rashii Henry
16,433 Pointsi have the latest of everything installed, thats why i confused about not being able to install cocoapods. matter of fact heres all the output:
ichange-lives:~ rashiihenry$ sudo gem install cocoapods Password: Building native extensions. This could take a while... ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.
"/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby" -rubygems /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rake-10.1.1/bin/rake RUBYARCHDIR=/usr/local/rvm/gems/ruby-1.9.3-p392/gems/xcodeproj-0.14.1/ext RUBYLIBDIR=/usr/local/rvm/gems/ruby-1.9.3-p392/gems/xcodeproj-0.14.1/ext
/usr/local/rvm/rubies/ruby-1.9.3-p392/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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:381:in try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:491:in
block in try_compile'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:443:in with_werror'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:491:in
try_compile'
from extconf.rb:24:in block in <main>'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in
block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in
checking_for'
from extconf.rb:23:in <main>'
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/...]
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/xcodeproj-0.14.1/ext/xcodeproj/Rakefile:37:in
block in <top (required)>'
Tasks: TOP => default => ext
(See full trace by running task with --trace)
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/xcodeproj-0.14.1 for inspection. Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/xcodeproj-0.14.1/ext/xcodeproj/gem_make.out ichange-lives:~ rashiihenry$
Amit Bijlani
Treehouse Guest TeacherThe error you posted above says: "You have to install development tools first", which means that it cannot find a compiler.
Try this from the command line:
xcode-select --install
It will install the command line tools.
Rashii Henry
16,433 PointsWhen i tried to download them, this was the message i was getting: cannot install the software because it is not currently available from the software update server.
Rashii Henry
16,433 PointsI keep getting an email to vote for the best answer but my question wasn't answered in this discussion. :/