Cocoapods 在Mac OS 10.15+ 安装失败
病情:
Fetching concurrent-ruby-1.1.6.gem
Fetching i18n-0.9.5.gem
Fetching thread_safe-0.3.6.gem
Fetching tzinfo-1.2.7.gem
Fetching minitest-5.14.1.gem
Fetching activesupport-4.2.11.3.gem
Fetching nap-1.1.0.gem
Fetching fuzzy_match-2.0.4.gem
Fetching httpclient-2.8.3.gem
Fetching algoliasearch-1.27.2.gem
Fetching ffi-1.12.2.gem
Fetching ethon-0.12.0.gem
Fetching typhoeus-1.4.0.gem
Fetching netrc-0.11.0.gem
Fetching cocoapods-core-1.9.1.gem
Fetching claide-1.0.3.gem
Fetching cocoapods-deintegrate-1.0.4.gem
Fetching cocoapods-downloader-1.3.0.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-search-1.0.0.gem
Fetching cocoapods-stats-1.1.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 CFPropertyList-3.0.2.gem
Fetching colored2-3.1.2.gem
Fetching nanaimo-0.2.6.gem
Fetching xcodeproj-1.16.0.gem
Fetching escape-0.0.4.gem
Fetching fourflusher-2.3.1.gem
Fetching gh_inspector-1.1.3.gem
Fetching cocoapods-1.9.1.gem
Fetching ruby-macho-1.4.0.gem
Successfully installed concurrent-ruby-1.1.6
Successfully installed i18n-0.9.5
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.7
Successfully installed minitest-5.14.1
Successfully installed activesupport-4.2.11.3
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
Successfully installed algoliasearch-1.27.2
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Users/soul/.rvm/gems/ext-ruby-2.6.3-p62/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20200521-58101-1mcq0zd.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 /Users/soul/.rvm/gems/ext-ruby-2.6.3-p62/gems/ffi-1.12.2 for inspection.
Results logged to /Users/soul/.rvm/gems/ext-ruby-2.6.3-p62/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out
解决思路:
0.终极目标是更新cocoapods,分析一下现在的状况是因为mac os升级10.15后不会自带升级ruby环境
1.现在的问题是gem干活不给力,找不到ruby的环境变量
2.升级ruby 需要先升级 rvm
3.升级rvm 需要依赖homebrew
4.安装homebrew 需要xcode command line
======
1.先appstore安装xcode 或者 softwareupdate -l (取代xcode-select--install)
2.安装 homebrew
3.安装rvm
4.更新ruby
#安装ruby前请安装组件
rvm requirements
rvm install 2.6.3
5.gem update
6.sudo gem install -n /usr/local/bin cocoapods