Install the Cocoapods command-line tool (sudo gem install cocoapods
), the following error occurs:
As we all know, Cocoapods is written in Ruby. Just as XCode12 requires macOS 10.15 or higher to install, the current version of Cocoapods1.9. x requires a later version of Ruby to install.
As shown above, the current Version of Ruby on your Mac is 2.6.0, so you can’t install the latest version of Cocoapods.
There are several solutions:
Download the latest version of Ruby:
1. Ensure that the terminal is in the state of wall climbing. If not, open the wall climbing software and find here:According to the ‘listening address’ (this is usually the case) and ‘listening port’ (if it is other wall climbing software, see hereJuejin. Cn/post / 699088…), enter the following two lines at the terminal:
Export https_proxy = http://127.0.0.1:1087
Export http_proxy = http://127.0.0.1:1087
2. Download the Ruby version management tool. Enter:
curl -L https://get.rvm.io | bash -s stable
3. Restart the terminal and climb over the wall.
Export https_proxy = http://127.0.0.1:1087
Export http_proxy = http://127.0.0.1:1087
4. Install the new ruby:
RVM install ruby 2.6
RVM use ruby - 2.6.3
RVM - the default use 2.6.3
5. Continue installing Cocoapods:
sudo gem install cocoapods
When installing Cocoapods, specify a lower version:
Sudo gem install Cocoapods -v 1.8.4