Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error instaling the cocoapods

here is the error:

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 extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

i've search on google for the last 7 hours and i can't find a solution that works for me. i have tried them all

Please help me up

edit: *after installing the RVM i stil get the same error

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 extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

using this command line : sudo gem install cocoapods

like image 265
ion Avatar asked Dec 02 '13 14:12

ion


People also ask

How do I know if CocoaPods is installed on my Mac?

To find if Cocoapods is installed or not run cmd (pod --version). if theresult is (Not Found) Pods is not installed.


1 Answers

You're on Mac OS. To get:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

you're trying to install gems into your system Ruby, which was installed by Apple for their use.

Don't do that.

Instead, use either rbenv or RVM to manage/install Rubies in a separate sandbox, where you're free to fold/spindle/mutilate to your heart's content.

If you opt for RVM, *read the ENTIRE installation instructions* before starting. RVM is very full-featured, and flexible, and those come at a price of additional "options" (AKA "complexity") when installing. Do it as a single-user, do not EVER use sudo, and you should be fine.

We can piggyback on Apple's system-instalation of Ruby, but don't modify it unless you really understand what you're doing; The error above makes me think this isn't the case.

To install a Ruby other than Apple's pre-installed one, odds are really good you'll need the current Xcode, along with the command-line extensions. That will provide the tools necessary to compile native extensions, plus all the headers needed:

  • https://developer.apple.com/xcode/
  • https://itunes.apple.com/us/app/xcode/id497799835‎
like image 172
the Tin Man Avatar answered Sep 22 '22 05:09

the Tin Man