Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have some problem cocoapods installation

I am trying to install cocoapods to my MacBook and after I ran this code into the terminal gem install cocoapods I get the following error:

****** ~ % sudo gem install cocoapods

    Password:
    Building native extensions. This could take a while...
    ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200413-663-1dklrnl.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out
like image 991
Rezo Joglidze Avatar asked Apr 13 '20 16:04

Rezo Joglidze


People also ask

Why are CocoaPods not installed?

Usually, this happens due to visual studio or IntelliJ not able to find the path or associated plugin or extension. Open your terminal and run sudo gem uninstall cocoapods sudo gem install cocoapods restart IDE or Editor Now your error must be solved.

How long does CocoaPods take to install?

Executing "pod install" now takes less than 2 minutes, while before making this changes it took about 12 minutes.


2 Answers

Looks like you don't have installed Ruby development headers.

You can fix this by installing Xcode command-line tools by executing these two commands:

xcode-select --install
sudo xcodebuild -license

Changes will apply after the computer restart.

like image 123
mickoush Avatar answered Oct 28 '22 04:10

mickoush


Goto Xcode preferences then click on Locations -> Command Line Tools -> Click on the drop down and check if any of it is available. If yes then select and set it. Then try to install cocoa pods it works as expected.

If no option is available in the drop down for Command Line Tools then use following commnands

xcode-select --install
sudo xcodebuild -license
like image 31
Snehal Avatar answered Oct 28 '22 04:10

Snehal