Step 1: Before installing cocoapods, check the environment: refer to the following:
1. First check the ruby version. ruby-v
2. Check the rvm version. rvm -v
3. View the source. gem sources -l
4. Remove the source. gem sources --remove https://rubygems.org/
5. Replace the source. gem sources --add https://gems.ruby-china.com/
6. Check whether the update is successful. gem sources -l
7. Download cocoapods
sudo gem install cocoapods
Reference:xcode - zsh : command not found: pod - MAcOS Catalina 10. 15 - IT Tool Network
Step 2: If it fails "zsh: command not found: pod"
Reference:zsh: command not found: pod - Jianshu
! ! ! ! It’s best to restart your computer! ! ! !
Then reinstall:
sudo gem install cocoapods
Three: Other failures are as follows:
Reference link:CocoaPods installation method-2021.08.24 - Short book