Cocoapods- ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.

Update CocoapoDS with the following error message
ERROR: ERROR installing cocoapods:
ERROR: Failed to build gem native extension.
The 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. cf9u3w/siteconf20200303-68332-1. The rb extconf. Rb
MKMF. Rb can ‘t find the header files for the 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
Trying to upgrade CocoapoDS requires a correct operation flow and the following command
1. Update GEM: Sudo GEM update — System
Remove gem Sources –remove https://ruby.taobao.org/
3. Modify gem sources: gem Sources -a https://gems.ruby-china.com
4, check whether the gem source is the latest: gem Sources – L
5. Update Cocoapods: Sudo Gem Install -n /usr/local/bin Cocoapods
6. Check the updated CocoapoDS version: POD — Version
Still no success.

wangpeideMacBook-Pro:~ wangpei$ rvm -v
-bash: rvm: command not found

Use the command RVM command to find the problem as follows: -bash: RVM: Command Not Found
Execute \curl -sSL https://get.rvm.io | basket-s stable –ruby

wangpeideMacBook-Pro:~ wangpei$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/wangpei/.rvm/
    RVM PATH line found in /Users/wangpei/.mkshrc /Users/wangpei/.profile /Users/wangpei/.bashrc /Users/wangpei/.zshrc.
    RVM sourcing line found in /Users/wangpei/.profile /Users/wangpei/.bash_profile /Users/wangpei/.zlogin.
Upgrade of RVM in /Users/wangpei/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate


Ruby enVironment Manager 1.29.9 (latest) (c) 2009-2017 Michal Papis, Piotr Kuczynski, Wayne E. Seguin

ruby-2.6.3 - #removing src/ruby-2.6.3..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.

Perform source/Users/XXXXXX. RVM/scripts/RVM RVM started


  * To start using RVM you need to run `source /Users/wangpei/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.
wangpeideMacBook-Pro:huobicloud_ios wangpei$ source /Users/wangpei/.rvm/scripts/rvm

RVM use ruby – 2.6.3
Execute the install command Sudo gem install Cocoapods or Sudo gem install -n /usr/local/bin cocoapods

ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://gems.ruby-china.com/ - no such name (https://gems.ruby-china.com/specs.4.8.gz)
ERROR:  Possible alternatives: cocoapods
wangpeideMacBook-Pro:~ wangpei$ gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/
wangpeideMacBook-Pro:~ wangpei$ sudo gem update --system
Latest version already installed. Done.
wangpeideMacBook-Pro:~ wangpei$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed cocoapods-1.9.2
Parsing documentation for cocoapods-1.9.2
Done installing documentation for cocoapods after 1 seconds
1 gem installed
wangpeideMacBook-Pro:~ wangpei$ pod --version
1.9.2

 

Read More: