Recently the company has just given a 27-inch imac,5k screen, this acid cool ~ ~, a new computer, unavoidable system upgrade, environment, when everything is ready, I will be ready to install cocoapods, however, all the previous tutorials have become useless ... However online a lot about MacOS Installation Cocoapods tutorial, dazzling, find a few good comprehensive look at the same time, combined with their own success examples, recorded ...
First of all, the computer is newly bought, of course, is completely not installed Cocoapods, the system is the latest MacOS 10.12.1,xcode 8.1, due to cocoapods1.1.1 's pit dad, first check their gem version and Ruby version ... Otherwise, the install will fail even if you replace the ruby source.
After Ruby-v is executed, the initial ruby version is 2.0.0,gem version 2.0.14.1
2.0 version seems to be unable to install, at least I myself in the execution of the sudo gem install cocoapods is a failure, so, first upgrade it!
The terminal performs the following code upgrade gem
sudo gem update--system
Execute the following code to upgrade Ruby to 2.2. Version 2:
The first step:
Curl-l Https://get.rvm.io | Bash-s Stable
Part II:
SOURCE ~/.RVM/SCRIPTS/RVM
Step Three:
检查是否安装成功
Rvm-v
结果 return rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
Fourth Step:
RVM list known
After executing the above code, the following results appear, showing all available ruby versions, selecting the latest version 2.2 for the upgrade installation
And then execute
RVM Install 2.2.2
Be patient, because to install brew first, a bunch of the following will appear when the installation succeeds.
OK, set the new Ruby to the default,
RVM 2.2.2--default
Person after inputruby -v 显示的ruby版本是你安装后的新版本,说明ruby安装成功!
Now we're going to change the ruby source.
Before has been used Taobao source, and now only found this and waste, information is too backward, had to use Cocoachina,
gem source -a https://gems.ruby-china.org/
再把旧的源移除
gem sources --remove https://rubygems.org/
保证只有一个china的源
完成之后,我们执行下列命令进行安装cocoapods!!
sudo gem install Cocoapods
The following information indicates that the installation was successful, otherwise please check if your ruby source and gem are upgraded successfully.
Check out the pod version:
yes! has been installed successfully, then use pod Setup to press ENTER, then point a cigarette, slowly wait for cocoapods installation is complete ...!
MacOS 10.12.1 + Xcode 8.1 installation Cocoapods 1.1.1