Cocoapods relies on Ruby, and there are many ways to install Ruby. The easiest one I know of is Brew Install Ruby

To use this command, you must: Have Homebrew installed; The installation method of Homebrew changes all the time (but the installation method is updated at http://brew.sh)

Today is 2016,7,12 installation method is: / usr/bin/ruby – e “$(curl – fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”


One: Install brew:

1. Open the terminal

2. Install homebrew

$ /usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”


Two: Install Ruby


1. Open the terminal

2. Install ruby

$ brew install ruby


Install Cocoapods


1. Open the terminal

2. Remove the existing Ruby default source

$ gem sources –remove https://rubygems.org/

3. Use new sources

Can solve: Error fetching https://ruby.taobao.org/:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://ruby.taobao.org/specs.4.8.gz)

This problem

Note here: Taobao no longer updates and maintains the Ruby source so the original tutorial is invalid

// $ gem sources -a https://ruby.taobao.org/

// Domestic Ruby source

The above is the original, now changed to: https://gems.ruby-china.org/

4. Check whether the new source is successfully replaced

$ gem sources -l

5. Install CocoaPods

$ sudo gem install cocoapods

$ pod setup

That’s it for the first time! I have to do my homework! Not screenshots!!!!