sudo gem install cocoapods
I've installed ruby 2.3.0 but I got the following error:
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 -I /Library/Ruby/Site/2.3.0 -r ./siteconf20200309-67350-e0q2jt.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
Seems like a ruby issue on your system. Please ask in StackOverflow instead.
But wouldn't it be helpful to at least mention the prerequisites in the docs?
This question has been asked on StackOverflow:
And on AskDifferent, the Apple-specific site on Stack Exchange:
I had the same problem on macOS Mojave 10.14.16
A few threads eventually lead me here which solved it for me:
It looks like CocoaPods 1.9.0, the latest version as of this writing, depends on a newer version of Ruby than 2.3.7. But macOS Mojave only includes Ruby 2.3.7, so you have a few different options.
- Upgrade to macOS Catalina and get Ruby 2.6.3
- Use Ruby Version Manager to install a newer version of Ruby
- Install an older version of CocoaPods
sudo gem install cocoapods -v 1.8.4
I did 3
sudo gem install cocoapods -v 1.8.4
I was installing Flutter, now flutter doctor
says "Xcode - develop for iOS and macOS" is OK.
I had a similar problem for macOS Catalina.
Here is what worked for me:
# brew cleanup -d -v
# brew install cocoapods
Hey, so I also had the same problem. This is probably happening because your computer has older version of ruby. So you need to first update your ruby. Mine worked for ruby 2.6.3 version.I got this solution from stackoverflow,
You need to first open terminal and put this code
curl -L https://get.rvm.io | bash -s stable
Then put this command
rvm install ruby-2.6
This would install the ruby for you if it hasn' t been installed.After this just update the ruby to the new version
rvm use ruby-2.6.3
After this just make ruby 2.6.3 your default
rvm --default use 2.6.3
This would possibly fix your issue. You can now put the command
sudo gem install cocoapods
And the command
pod setup
I hope this was useful
This occurs due to an issue with how xcode 11 is shipped on different MacOS versions. Read more here: https://stackoverflow.com/a/58226876/5066615
Worked for me.
Most helpful comment
I had the same problem on macOS Mojave 10.14.16
A few threads eventually lead me here which solved it for me:
I did 3
sudo gem install cocoapods -v 1.8.4
I was installing Flutter, now
flutter doctor
says "Xcode - develop for iOS and macOS" is OK.