Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem native extension error while installing cocoapods

Tags:

ios

cocoapods

Am trying to reinstall cocoapods in my MacBook air after changing my SSD, now am getting this bellow error.

sudo gem install cocoapods

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.3.0/gems/ffi-1.12.2/ext/ffi_c 

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200308-27204-6l0a5q.rb extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection. Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out

like image 927
Peter Avatar asked Mar 08 '20 08:03

Peter


People also ask

Should I install CocoaPods with GEM or homebrew?

If you try to install a gem through pre-installed Ruby, you've to use sudo by default witch is not a good practice. Another option is to install CocoaPods in your user-level directory by following instructions available on the Sudo-less installation section. I would suggest you install CocoaPods using brew .


2 Answers

Open Terminal

curl -L https://get.rvm.io | bash -s stable

Reopen Terminal

rvm install ruby-2.6

rvm use ruby-2.6.3

rvm --default use 2.6.3

From MahmoudKhaled's comment on link

like image 126
Davut Engin Avatar answered Sep 18 '22 01:09

Davut Engin


For me it worked by installing a previous version of cocoapods

sudo gem install cocoapods -v 1.8.4 

Hope it helps

like image 24
Kevin Oswaldo Avatar answered Sep 17 '22 01:09

Kevin Oswaldo