CocoaPods

1、Check the gem version:

gem --version
sudo gem update --system

3、Change the gem source:

sudo gem --remove https://rubygems.org

sudo gem --add http://gems.ruby-china.org

4、Use the Sudo-less install method to install CocoaPods:

a)、Create a new directory in your Home directory, such as Vendor/ruby

b)、export GEM_HOME=$HOME/Vendor/ruby

c)、export PATH=$HOME/Vendor/ruby/bin:$PATH

d)、gem install cocoapods -v 1.5

5、Add the environment variable from step 3b to the ~/.bash_profile file (if you have an Apple M1 chip, use the ~/.zshrc file) and execute:

source ~/.bash_profile

Files related to CocoaPods that are installed using the above method will be installed in the Vendor/ruby directory under your home directory.

Execute the command pod –version in the terminal, if the result is 1.5, it means the installation was successful.