Brief introduction
Sometimes the following error occurs when installing Cocoapods
ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
This means that your ruby environment needs to be updated, and I'll take the detailed steps to update the Ruby environment using the update Ruby method under Mac OS 10.11 as an example.
Causes and scenarios
During the installation of Cocoapods, the Ruby version is required to be at least 2.2.2, while the Ruby version currently in use is the Mac system's own 1.8.7. So you need to upgrade Ruby. Here are three ways to install Ruby:
1. Download Ruby source code, compile, install
2. Use the installation package that comes with the release version, install
3. Install with RVM
Install ruby detailed steps with RVM
It's recommended that you upgrade Ruby through RVM.
1> Installing RAM
Rvm:ruby version Manager,ruby release manager, including Ruby version management and GEM Library Management (Gemset)
$ curl -L get.rvm.io | bash -s stable
2> loading files to test for normal installation (follow the instructions)
$ source ~/.bashrc $ source ~/.bash_profile $ source ~/.profile$ rvm -v
3> If you have the following tips, please reload RVM
A RVM version 1.27.0 (latest) is installed yet 1.25.23 (stable) is loaded.Please do one of the following: * ‘rvm reload‘ * open a new shell * ‘echo rvm_auto_reload_flag=1 >> ~/.rvmrc‘ # for auto reload with msg. * ‘echo rvm_auto_reload_flag=2 >> ~/.rvmrc‘ # for silent auto reload.
Enter the command:
$ rvm reload$ rvm -v
4> View current ruby version, get RVM list
$ ruby -v $ rvm list known
5> installing Ruby may have errors (skip to step 6th if not in error)
$ rvm install 2.3
Error 1: When you install Ruby, you may get an error as follows, prompting Updating System[yourmacname] password required for ' PORT-DV self Update ', as follows:
Solve:
To update:
$ sudo port self update
After the update is complete,:
Error 2:
Or you may encounter the following error because you need to install homebrew.
‘requirements_osx_port_libs_install curl-ca-bundle automake libtool libyaml libffi libksba‘,showing last 15 lines of /Users/acewill/.rvm/log/1468253599_ruby-2.3.0/package_install_curl-ca-bundle_automake_libtool_libyaml_libffi_libksba.log
Solve:
Refer to the problem on the stack overflow installing RVM: "Requirements installation failed with status:1."
To install homebrew, use the following command:
-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
6> re-installing Ruby
After the installation is complete, re-execute the command to install Cocoapods.
$ rvm install 2.3
7> Installing Rails
$ gem install rails
8> Uninstalling the Ruby method
Get a list of Ruby installed and then uninstall Ruby
$ rvm list$ rvm remove 2.3
Cocoapods: Install/update Ruby Environment tutorial