error instaling the cocoapods
Asked Answered
H

5

8

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

Honourable answered 2/12, 2013 at 14:16 Comment(1)
What did you run to generate this error? What system are you on?Fissure
S
3

Try "brew install cocoapods" instead and it will get cocoapods installed without this error.

Stadtholder answered 4/6, 2023 at 21:35 Comment(0)
R
1

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:

Rapprochement answered 2/12, 2013 at 14:24 Comment(2)
since i don't know what i'm doing in the terminal, can you please help me up on installing the cocoapods ? i have edited the question with the new info.Honourable
Did you read the part that says "do not EVER use sudo"? Did you install a version of Ruby in RVM's sandbox using rvm install 2.0.0-p...? Did you tell RVM to use that version by entering rvm use 2.0.0-p... --default?Rapprochement
P
1

It's customary to advise people to install something like rvm or rbenv before installing CocoaPods. As one of the developers behind CocoaPods I'd like to say that you don't have to do any of that unless you are planning to do ruby work yourself. If you're just interested in getting CocoaPods to work there's no need for all the overhead of a ruby manager.

To quote the CocoaPods guides:

CocoaPods is built with Ruby and it will be installable with the default Ruby available on OS X. You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on OS X unless you know what you're doing.

Using the default Ruby install will require you to use sudo when installing gems. (This is only an issue for the duration of the gem installation, though.)

$ sudo gem install cocoapods

Pawn answered 3/12, 2013 at 5:5 Comment(1)
sorry, it has been a whille. i gave up on installing the "cocoaPods".I was in a huge dificoulty to get it work. It has been a whille since i developed somthing on the OS X, or iOs, but cocoapods, turned out to be much more dificoult then anything i have tryied to use. Even openGL it turn to be more easy to use and comprehand. I stronggly syggest on a better doc!Honourable
M
0
sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

It worked for me.

Monetmoneta answered 29/3 at 11:26 Comment(0)
A
-1

is just easier install cocoapods separately (eg: using brew), and exporting the path.

Alti answered 26/12, 2023 at 9:58 Comment(1)
As you are not providing a concrete answer and rather suggesting something, this should be a comment. Once you earn enough reputation, you'll be able to comment everywhereGirdler

© 2022 - 2024 — McMap. All rights reserved.