Cocoapods cannot be used/installation failure/failure solution, cocoapods Solution
Cocoapods is an integrated management tool for third-party class libraries in ios. It allows you to integrate all the class libraries in git without any configuration, and facilitates management, making your ios Project look less messy. After installing this tool, after a while, you may suddenly find that its commands cannot be used. This problem has something to do with IOS system upgrades. Maybe when you upgrade your mac OS to an official version, it will suddenly be unavailable, so after the ios system is upgraded, we also need to upgrade the cocoapods official new version, otherwise it will not be available. In addition, this problem is related to the cocoapods upgrade, and suddenly cannot be used. When we upgrade, we may find that the upgrade fails. In fact, all these problems finally point to the ruby version. ruby is a cocoapods framework, and cocoapods should be developed with it. To solve the problem of cocoapods errors, first check the default ruby version in the system, including the ruby version that we need to upgrade when installing cocoapods. Next, let's talk about several ruby operation commands. Using these commands can completely solve the problem of cocoapods. I don't want to talk about how to install cocoapods. There are too many online commands and I will find them myself.
1. query all currently available ruby version commands:
Rvm list known
2. Select a version for installation:
Rvm install 2.3
The default ruby version in mac OS is 2.0. Currently, cocoapods cannot be installed in ruby of this version.
Yes. You must upgrade ruby.
3. query whether the ruby version is installed.
Rvm list
By default, mac OS comes with the ruby version, so after you install a new version, the system will query at least two versions.
4. Uninstall redundant ruby versions
Rvm remove 2.2.2 (here, 2.2.2 = the version number in the system, which can be seen in the previous step)
After a new ruby version is installed, You can uninstall the old version.
5. Set the default ruby version.
Rvm 2.2.4 -- default
6. Check the ruby version set in the previous step.
Ruby-v