To install cocoapods successfully, run sudo gem install cocoapods. However, the installation fails due to various reasons.
-
The Ruby version is too early. Upgrade the Ruby version first
brew update
brew install ruby
After executing 👆, ruby -v shows that the version is the same as before because the environment variables are not configured. Therefore, another step is to configure environment variables.
echo ‘export PATH=”/usr/local/opt/ruby/bin:$PATH”‘ >> ~/.bash_profile
source ~/.bash_profile
ruby -v
After the command is executed, the system checks the version and determines that the version is updated to the latest version.
-
-bash: pod: command not found
The solution is to remove the installed Cocoapods
Execute the command gem list – local | grep cocoapods lists cocoapods related project will, in turn, to delete
sudo gem uninstall cocoapods
Then run sudo gem install -n /usr/local/bin cocoapods to install cocoapods
Sudo chmod +rx /usr/local/bin You can change the system permission of usr/local/bin if necessary
pod –version
1.10.1
To solve the problem of installing Cocoapods