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

执行pod更新活安装时报错

sudo gem install -n /usr/local/bin cocoapods
image.png
  1. 安装 rvm
curl -L https://get.rvm.io | bash -s stable

如果可以安装成功并出现下列的提示则可以直接进行第二步


Upgrade of RVM in /Users/mengshun/.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

如果失败, 出现了下方的错误(报错内容 curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out)

➜  Ruby: curl -L https://get.rvm.io | bash -s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    166      0  0:00:01  0:00:01 --:--:--   166
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
  • 执行下列的指令
sudo gem install redis
  • 然后继续执行rvm的安装命令 (
    curl -L https://get.rvm.io | bash -s stable)

如果还是报 443 错误, 那就等一会再执行或者换另一种方法

UP_W

问题记录_安装cocoaPods失败【提示:ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.】

问题:
安装cocoaPods失败
sudo gem install cocoapod
报错:【提示:ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.】

百度发现可能ruby版本问题

rvm -v
报错:-bash: rvm: command not found

安装ruby:

\curl -sSL [https://get.rvm.io](https://get.rvm.io/) | bash -s stable --ruby

报错:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决:

1.通过地址https://blog.csdn.net/qq_43531694/article/details/106862753
方式一解决ruby安装问题完成安装
会自动装上最新版。更新RVM版本:$ rvm get stable

载入RVM环境

source ~/.rvm/scripts/rvm

2、安装Ruby

列出ruby可安装的版本

rvm list known
rvm install ruby-2.6

3、设置Ruby版本

设置默认版本

rvm 2.5.3 --default
sudo gem install -n /usr/local/bin cocoapods
Password:
Fetching concurrent-ruby-1.1.8.gem
Fetching i18n-1.8.10.gem
Fetching thread_safe-0.3.6.gem
Fetching tzinfo-1.2.9.gem
Fetching activesupport-5.2.6.gem
Fetching fuzzy_match-2.0.4.gem
Fetching nap-1.1.0.gem
Fetching httpclient-2.8.3.gem
Fetching ffi-1.15.1.gem
Fetching ethon-0.14.0.gem
Fetching typhoeus-1.4.0.gem
Fetching netrc-0.11.0.gem
Fetching public_suffix-4.0.6.gem
Fetching addressable-2.7.0.gem
Fetching cocoapods-core-1.10.1.gem
Fetching algoliasearch-1.27.5.gem
Fetching claide-1.0.3.gem
Fetching cocoapods-deintegrate-1.0.4.gem
Fetching cocoapods-downloader-1.4.0.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-search-1.0.0.gem
Fetching cocoapods-trunk-1.5.0.gem
Fetching cocoapods-try-1.2.0.gem
Fetching molinillo-0.6.6.gem
Fetching atomos-0.1.3.gem
Fetching colored2-3.1.2.gem
Fetching nanaimo-0.3.0.gem
Fetching xcodeproj-1.19.0.gem
Fetching escape-0.0.4.gem
Fetching fourflusher-2.3.1.gem
Fetching gh_inspector-1.1.3.gem
Fetching ruby-macho-1.4.0.gem
Fetching CFPropertyList-3.0.3.gem
Fetching cocoapods-1.10.1.gem
Successfully installed concurrent-ruby-1.1.8
Successfully installed i18n-1.8.10
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.9
Successfully installed activesupport-5.2.6
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Building native extensions. This could take a while...
Successfully installed ffi-1.15.1
Successfully installed ethon-0.14.0
Successfully installed typhoeus-1.4.0
Successfully installed netrc-0.11.0
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.7.0
Successfully installed cocoapods-core-1.10.1
Successfully installed claide-1.0.3
Successfully installed cocoapods-deintegrate-1.0.4
Successfully installed cocoapods-downloader-1.4.0
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-search-1.0.0
Successfully installed cocoapods-trunk-1.5.0
Successfully installed cocoapods-try-1.2.0
Successfully installed molinillo-0.6.6
Successfully installed atomos-0.1.3
Successfully installed CFPropertyList-3.0.3
Successfully installed colored2-3.1.2
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.19.0
Successfully installed escape-0.0.4
Successfully installed fourflusher-2.3.1
Successfully installed gh_inspector-1.1.3
Successfully installed ruby-macho-1.4.0
Successfully installed cocoapods-1.10.1
Parsing documentation for concurrent-ruby-1.1.8
Installing ri documentation for concurrent-ruby-1.1.8
Parsing documentation for i18n-1.8.10
Installing ri documentation for i18n-1.8.10
Parsing documentation for thread_safe-0.3.6
Installing ri documentation for thread_safe-0.3.6
Parsing documentation for tzinfo-1.2.9
Installing ri documentation for tzinfo-1.2.9
Parsing documentation for activesupport-5.2.6
Installing ri documentation for activesupport-5.2.6
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for httpclient-2.8.3
Installing ri documentation for httpclient-2.8.3
Parsing documentation for algoliasearch-1.27.5
Installing ri documentation for algoliasearch-1.27.5
Parsing documentation for ffi-1.15.1
Installing ri documentation for ffi-1.15.1
Parsing documentation for ethon-0.14.0
Installing ri documentation for ethon-0.14.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for cocoapods-core-1.10.1
Installing ri documentation for cocoapods-core-1.10.1
Parsing documentation for claide-1.0.3
Installing ri documentation for claide-1.0.3
Parsing documentation for cocoapods-deintegrate-1.0.4
Installing ri documentation for cocoapods-deintegrate-1.0.4
Parsing documentation for cocoapods-downloader-1.4.0
Installing ri documentation for cocoapods-downloader-1.4.0
Parsing documentation for cocoapods-plugins-1.0.0
Installing ri documentation for cocoapods-plugins-1.0.0
Parsing documentation for cocoapods-search-1.0.0
Installing ri documentation for cocoapods-search-1.0.0
Parsing documentation for cocoapods-trunk-1.5.0
Installing ri documentation for cocoapods-trunk-1.5.0
Parsing documentation for cocoapods-try-1.2.0
Installing ri documentation for cocoapods-try-1.2.0
Parsing documentation for molinillo-0.6.6
Installing ri documentation for molinillo-0.6.6
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for CFPropertyList-3.0.3
Installing ri documentation for CFPropertyList-3.0.3
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for xcodeproj-1.19.0
Installing ri documentation for xcodeproj-1.19.0
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for ruby-macho-1.4.0
Installing ri documentation for ruby-macho-1.4.0
Parsing documentation for cocoapods-1.10.1
Installing ri documentation for cocoapods-1.10.1
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, public_suffix, addressable, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-trunk, cocoapods-try, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 39 seconds
34 gems installed
~~~~:~ linmac$ pod --version
1.10.1
~~~~:~ linmac$ 

你可能感兴趣的:(ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.)