Replace the source (because Ruby's software source rubygems.org is blocked, the invisible wall in China, we need to modify and replace the source, switch the source to ruby-china; most of the online use https://ruby.taobao. org, it is no longer recommended to use here, this is because the taobao Gems source has stopped maintenance, and is now provided by ruby-china to provide mirror services)
Execute the command:
gem sources --remove https://rubygems.org/
gem sources -- a https://gems.ruby-china.org/
Next, to check whether the source path is successfully replaced, execute the command:
gem sources -l
To update Ruby, execute the following command:
sudo gem update --system
Start installing Cocoapods, execute the command:
sudo gem install cocoapods
may report an error
Execute the command sudo gem install -n /usr/local/bin cocoapods
After a successful pod setup
, after a long wait, you can use Pods happily.