Preface,

In the iOS development [CocoaPods] (https://github.com/CocoaPods/CocoaPods) as a library dependency management tool is a weapon.

CocoaPods eliminates the cumbersome task of dragging third-party libraries and the framework static libraries they depend on into your project by simply typing commands from a Terminal. Updates that involve third-party libraries can also be managed manually through CocoaPods.

Easy and fast! Act now!!

Homebrew, Rvm, Ruby, CocoaPods

  • 1. Official website and related links

https://www.rvm.io/ Ruby: https://rubygems.org/ CocoaPods: https://cocoapods.org/ Rvm installation Guide: The Homebrew’s official website: https://rvm.io/rvm/install http://brew.sh/index_zh-cn.html ruby mirror – taobao: https://ruby.taobao.org/ Ruby Image-China: https://gems.ruby-china.org/

  • 2. Introduction to Homebrew

    • HomebrewIs a package manager for installing UNiX tools on the MAC that are not available on OS X. Similar to 360 software Manager.
  • 3. Introduction to Rvm

    • RvmThe full nameRuby Version Manager, is installation and managementrubyIs a tool of the.
    • Excerpt:RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
  • 4. Introduction to Ruby

    • RubyIs an object – oriented scripting language, easy to use, powerful. Cross-platform and portability and so on. It’s basically a scripting language.
    • RubyThe software source is amazon’s cloud service, the domestic network environment may be unstable and timeout, so the built-in need to go over the wall, can beThe official ruby sourceReplace with domesticTaobao ruby source(ruby.taobao.org/) or byChina ruby source (gems.ruby-china.org/). According to sources, June 2016Taobao sourceSuspended maintenance, recommended useChina ruby source.
  • 5. Introduction to CocoaPods

    • CocoaPodsIOS is the most commonly used third-party class library management tool, most well-known open source class library supportCocoaPods.
    • CocoaPodsIs to userubyIn order to use it you first need to haverubyIn the environment. Fortunately, OS X already runs by defaultruby. But sometimesrubyIf the version is too early, it cannot be supportedCocoaPodsUse, so need to install the update upgrade firstrvmruby.

Install and use CocoaPods

  • 1. Check the RVM installation environment (skip this step in normal cases)

    • Check the currentrvmEnvironment (Check whether it exists herervmEnvironment) :
$ rvm -v
Copy the code
Copy the code

Output result: Muxuguixiandemacbook-pro :~ Jijiucheng $RVM -v RVM 1.27.0 (latest) by Wayne E. Seguin muxuguiXIANdemacbook-Pro :~ Jijiucheng $RVM -V RVM 1.27.0 (latest) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]

Copy the code

Muxuguixiandemacbook-pro :~ jijiucheng$RVM-V-bash: RVM: Command not found

- ** Case 1 ** : If no 'RVM' environment exists, install and configure the 'RVM' environment first;Copy the code

You may be asked for your sudo administrator password and automatically install dependencies through Homebrew. After a while, the RVM is successfully installed.

Copy the code

$ curl -L https://get.rvm.io | bash -s stable

> ` ` ` output: (download) (show ` ` represents one line space) muxuguixiandeMacBook - Pro: https://get.rvm.io ~ jijiucheng $curl - L | bash-s stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0     93      0  0:00:01  0:00:01 --:--:--    93
100 22865  100 22865    0     0   8964      0  0:00:02  0:00:02 --:--:--  710k
Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc',
but no GPG software exists to validate it, skipping.
``
`Installing RVM to /Users/smalllufeinj/.rvm/`
    Adding rvm PATH line to /Users/smalllufeinj/.profile /Users/smalllufeinj/.mkshrc /Users/smalllufeinj/.bashrc /Users/smalllufeinj/.zshrc.
    Adding rvm loading line to /Users/smalllufeinj/.profile /Users/smalllufeinj/.bash_profile /Users/smalllufeinj/.zlogin.
`Installation of RVM in /Users/smalllufeinj/.rvm/ is almost complete:`
``
  .* To start using RVM you need to run `source /Users/smalllufeinj/.rvm/scripts/rvm`
    in all your open shell windows, in rare cases you need to reopen all shell windows.
``
# muxuguixian,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
``
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
Copy the code

  • Copy the code

② Then, load the RVM environment (you don’t need to do this when you start Termal, it will be reloaded automatically).

Copy the code

$ source ~/.rvm/scripts/rvm

Muxuguixiandemacbook-pro :~ jijiucheng$source ~/.rvm/scripts/rvm
Copy the code
  • Copy the code

3 Check whether the RVM is correctly installed.

Copy the code

$ rvm -v

>``` ` Output: Muxuguixiandemacbook-pro :~ Jijiucheng $RVM-V RVM 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]Copy the code
  • Case 2: If presentrvmThe environment,rvmThe installationrubyThe environment;
  • whenrubyVersion below2.2.2When the installationCocoaPodsComplains; In order to preventrubyIf the version is too early, upgrade it firstrubyEnvironment, recommended upgrade to2.3.0Version above. [Can be passed$ ruby -vCommand to check current Ruby version
① Query the known Ruby environment.Copy the code
$ rvm list known
Copy the code
Copy the code

Muxuguixiandemacbook-pro :~ jijiucheng$RVM list known

MRI Rubies

[ruby -] 1.8.6 [- p420] [ruby -] 1.8.7 [- head] # security released on head [ruby -] 1.9.1 [- p431] [ruby -] 1.9.2 [- p330] [ruby -] 1.9.3 [- p551] [ruby -] 2.0.0 [- p648] [ruby -] 2.1. [8] [ruby -] 2.2 [4] [ruby -] 2.3 [0] [ruby -] 2.2 – head ruby – head ` `

For forks use: RVM install ruby – head – 2.2 – url https://github.com/github/ruby.git – branch

` `

JRuby

Engine 1.6. [8] works 1.7. [23] works [- 9.0.5.0] works – head ` `

Rubinius

[4.3] RBX RBX – 1-2.3. [0] RBX 2.4 RBX. [1] [- 2.5.8] RBX – head ` `

Opal

opal “

Minimalistic ruby implementation – ISO 30170:2012

mruby[-head] “

Ruby Enterprise Edition

Ree – 1.8.6 ree [7] – [2012.02] ` `

GoRuby

goruby “

Topaz

topaz “

MagLev

Maglev [- head] maglev – 1.0.0 ` `

Mac OS X Snow Leopard Or Newer

Macruby-0.10 macruby-0.11 macruby[-0.12] macruby-nightly macruby-head ‘

IronRuby

Constant – 1.1.3 constant – the head

! [query known Ruby environment.png](http://upload-images.jianshu.io/upload_images/711060-1368757fe3502d2d.png? ImageMogr2 /auto-orient/strip% 7cImageView2/2 /w/1240) - "'" specifies the ruby version to be updated.Copy the code
$RVM install 2.3.0Copy the code
Copy the code

Output result :(because the terminal output too many characters, the screenshot is used here)

! [Specify ruby version for update.png](http://upload-images.jianshu.io/upload_images/711060-7befae589754d80a.png? ImageMogr2 /auto-orient/strip% 7cImageView2/2 /w/1240) - (3) The second step takes some time to wait, after which the RVM environment is configured; Ruby Gems is installed.Copy the code
④ Supplementary instructions:Copy the code

Query installed Ruby:

$ rvm list
Copy the code

Uninstall an installed version:

$RVM remove 1.9.2Copy the code
  • 2. Check the update Ruby version environment (normally start from this step)

    • CocoaPodsIs to usegem rubyIn order to use it you first need to havegem rubyIn the environment. MAC OS X already runs by defaultruby
    • The advice heregem rubyPackage environment upgrade toX 2.6.The above.
    • checkgem rubyThe version number:
$ sudo gem -v
Copy the code
Copy the code

Muxuguixiandemacbook-pro :local jijiucheng$gem -v 2.5.1 muxuguiXIANdemacbook-pro :local jijiucheng$gem -v 2.5.1

- Update 'gem Ruby' version number:Copy the code

$ gem update –system

> ' '< span style = "box-sizing: border-box; color: RGB (51, 51, 51);localjijiucheng$ gem update --system Updating rubygems-update Fetching: Rubygems-update-2.6.7. Gem (100%) Successfully installed rubygems-update-2.6.7Copy the code
Such a reminder: Muxuguixiandemacbook-pro :~ jijiucheng$gem update -- System Latest version currently installed. Aborting.Copy the code
  • checkRuby source
$ gem sources -l
Copy the code
Copy the code

Inspection Results: (If you haven’t installed CocoaPods on your computer, Muxuguixiandemacbook-pro :~ jijiucheng$gem sources -l *** CURRENT sources *** https://rubygems.org/

- Remove 'Ruby source'Copy the code

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

> ' 'result: muxuguidemacbook-pro:local jijiucheng$ gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
Copy the code
  • Replace Adds a domestic mirror sourceRuby - China sourceBecause the domestic mirror source has been mentioned aboveTaobao sourceMaintenance has been stopped, so insteadRuby - China source“And try to make sure there is only oneRuby - China source
$ gem sources --add https://gems.ruby-china.org
Copy the code
Copy the code

Replacement result: muxuguixiandeMacBook-Pro:local jijiucheng$ gem sources –add https://gems.ruby-china.org https://gems.ruby-china.org added to sources

Copy the code

Check the Ruby source again at this point: Muxuguixiandemacbook-pro: Local jijiucheng$gem sources -l *** CURRENT sources *** https://gems.ruby-china.org


- Install CocoaPods- Install CocoaPods (' sudo 'means administrator execute command) (' password needs to be entered once here')Copy the code

$ sudo gem install cocoapods

Copy the code

Note: < — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — > a note points here Because of the different OS X, the instruction of here is also some changes: $sudo gem install CocoaPods after OS X 10.11 install CocoaPods from CocoaPods. $ sudo gem install -n /usr/local/bin cocoa pods

> < span style = "max-width: 100%; clear: both; min-height: 1em;localJijiucheng $sudo gem install cocoa pods Password: < -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > / / here need to enter a Password Fetching: Gem (100%) Building native extensions. This could take a while... Successfully installed ffi - 1.9.14 Fetching: Gem (100%) Successfully installed thread_safe-0.3.5 Fetching: Tzinfo-1.2.2. Gem (100%) Successfully installed tzinfo-1.2.2 Fetching: I18n-0.7.0 Fetching (100%) Successfully installed I18N-0.7.0 Fetching: Gem (100%) Successfully installed concurrent-ruby-1.0.2 Fetching: Activesupport-5.0.0.1. Gem (100%) Successfully installed Activesupport-5.0.0.1 Fetching: Cocoa 0.1.6. Gem (100%) Successfully installed Cocoa 0.1.6 Parsing documentationforFfi - 1.9.14 Installing ri documentationforFfi - 1.9.14 Parsing documentationforThread_safe - 0.3.5 Installing ri documentationforThread_safe - 0.3.5 Parsing documentationforTzinfo - 1.2.2 Installing ri documentationforTzinfo - 1.2.2 Parsing documentationforI18n - 0.7.0 Installing ri documentationforI18n - 0.7.0 Parsing documentationforConcurrent - ruby - 1.0.2 Installing ri documentationforConcurrent - ruby - 1.0.2 Parsing documentationforActivesupport - 5.0.0.1 Installing ri documentationforActivesupport - 5.0.0.1 Parsing documentationforCocoa - 0.1.6 Installing ri documentationforCocoa - 0.1.6 Done installing documentationforffi, thread_safe, tzinfo, i18n, concurrent-ruby, activesupport, cocoa after 34 seconds Fetching: Pods-0.0.1. Gem (100%) Successfully installed Pods-0.0.1 Parsing documentationforThe pods - 0.0.1 Installing ri documentationforThe pods - 0.0.1 Done installing documentationforThe pods after 8 0 seconds gems installed < -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- here are gems installed marks the installation CocoaPods success -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- >Copy the code

  • Normally this would be a big bug, and there would be various errors, mostly due to the ruby environment being too low and not being updated, or problems involving the RVM manager environment, which will be mentioned in the solution of various errors later.

  • 4. Configure CocoaPods

    • Note: To test this, create a project CocoaPodsTestDemo on the MAC Desktop.

    • Step 1: CD to the directory folder, press Enter (fast: directly drag the folder into Terminal).

$ cd /Users/jijiucheng/Desktop/CocoaPodsTestDemo 
Copy the code
Copy the code

Enter the results) : ((^_^) at this time no muxuguixiandeMacBook – Pro: ~ jijiucheng $CD/Users/jijiucheng/Desktop/CocoaPodsTestDemo

- ** Step 2 (Recommended) ** : If you do not know the version of the third-party library, you are advised to find the latest version of the required third-party library, which can be completed by entering the command. After the query, enter 'wq' to return to the previous Terminal 'Terminal' page.Copy the code

$ pod search ‘AFNetworking’

> ' 'query result :(because it will query output all and'AFNetworking'Related third-party library, only part of which is output here, where the "line" below replaces the actual printed line space) muxuguixiandemacbook-pro :~ jijiucheng$cd /Users/jijiucheng/Desktop/CocoaPodsTestDemo 
muxuguixiandeMacBook-Pro:CocoaPodsTestDemo jijiucheng$ pod search 'AFNetworking'-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - (here is the output) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > AFNetworking (3.1.0) A delightful iOS and OS X networking framework. pod'AFNetworking'.'~ > 3.1.0'- Homepage: https://github.com/AFNetworking/AFNetworking - Source: https://github.com/AFNetworking/AFNetworking.git - Versions: 3.1.0, 3.0.4 3.0.3, 3.0.2 3.0.1, 3.0.0, 3.0.0 - beta. 3, 3.0.0 - beta. 2, 3.0.0 - beta. 1, 2.6.3, 2.6.2, 2.6.1, server, 2.5.4, 2.5.3, 2.5.2 2.5.1 2.5.0, against 2.4.1, 2.4.0, 2.3.1, 2.3.0 and 2.2.4, 2.2.2, 2.2.3, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.0 -rc3 2.0.0 - RC2, 2.0.0 RC1, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0 RC3, 1.0 RC2, 1.0 RC1, 0.10.1 0.10.0, 0.9.2, 0.9.1, 0.9.0, 0.7.0, 0.5.1 [master repo] - Subspecs: - AFNetworking/Serialization (3.1.0) - AFNetworking/Security (3.1.0) - AFNetworking/Reachability (3.1.0) - AFNetworking/NSURLSession (3.1.0) - AFNetworking/UIKit (3.1.0)... There are more and more'AFNetworking'Related third-party libraries are not listed here.)Copy the code

  • Step 3: Create the Podfile configuration file
$ vim Podfile
Copy the code
Copy the code

Enter jump interface (as follows) :

! PNG after vim Podfile (http://upload-images.jianshu.io/upload_images/711060)-a67f673c2e5bab9f.png? ImageMogr2 /auto-orient/strip% 7cImageView2/2 /w/1240) - "'" - "" "" "" "" "" "" "" "" "" ""Copy the code
Copy the code

Podfile configuration file editing mode (as follows) :

! [Podfile configuration file editing mode.png](http://upload-images.jianshu.io/upload_images/711060-d812ea5319337128.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) -Copy the code
Copy the code

Note: Some people may see a different set of fixed statements, but they are all pretty much the same. ` > — –

Uncomment this line to define a global platform for your project

platform :ios, ‘8.0’ target ‘CocoaPodsTestDemo’ do # Uncomment this line if you’re using Swift or would like to use dynamic frameworks # Pods for CocoaPodsTestDemo pod ‘AFNetworking’, ‘~> navigation ‘MBProgressHUD’ pod ‘FMDB’ pod ‘loading’ post ‘mjpost’ pod ‘MJRefresh’

use_frameworks!

pod ‘ReactiveCocoa’

end

! [Podfile configuration file fixed statement.png](http://upload-images.jianshu.io/upload_images/711060-edb4e3eb4047a035.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 / W /1240) - ' '(3) After the fixed statement input, press Esc to exit editing mode, the bottom of the' -- INSERT -- 'flag is not displayed; Press 'againshift+ : '(in English input mode), the bottom will appear a colon:'; Finally, type 'wq' and press enter to return to the Podfile configuration screen. The Podfile is now configured; You can now find an extra 'Podfile' in the 'CocoaPodsTestDemo' folder.Copy the code
Copy the code

After the Podfile has been entered (as follows) :

! [Podfile after entering.png](http://upload-images.jianshu.io/upload_images/711060-718d2be704c64c8f.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ! [Add Podfile.png after configuration file is complete](http://upload-images.jianshu.io/upload_images/711060-3ba0fd1a2c88bc43.png? ImageMogr2 /auto-orient/ Strip % 7CImageView2/2 / W /1240) - ** Step 4 ** : Download the third-party library file to the project projectCopy the code

$ pod install

> ' 'download output (as follows) :  muxuguixiandeMacBook-Pro:CocoaPodsTestDemo jijiucheng$ pod install Analyzing dependencies Downloading dependencies Installing AFNetworking (3.1.0) Installing FMDB (2.6.2) Installing MBProgressHUD (1.0.0) Installing MJExtension (3.0.13) Installing MJRefresh (3.1.12) Installing INSTALLATION (1.0.2) Installing SDWebImage (3.8.2) Generating Pods Project Integrating client project [!]  Please close any current Xcode sessions and use `CocoaPodsTestDemo.xcworkspace`for this project from now on.
Pod installation complete! There are 7 dependencies from the Podfile and 7 total pods
installed.
Copy the code

  • ** Step 5 ** : After that, just click open to open the projectCocoaPodsTestDemo.xcworkspacefile
Copy the code

Open the project file directory changes (below) : all the third-party libraries/CocoaPodsTestDemo/Pods/Pods folder directory

! [Open project file directory change.png](http://upload-images.jianshu.io/upload_images/711060-b4042e8dde397cbd.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)CocoaPods installation error is resolved
<p>
- ##### Note: The problems listed in this section are reported during the execution of related commands
<p>
- ### 1. Rvm environment construction- ** Error: ** **① Error running'requirements_osx_brew_update_system ruby - 2.3.0', showing last 15 lines of /Users/jijiucheng/.rvm/log/ 1475769205_update_system. log ② curl: (35) Server aborted the SSL Handshake ** <p> > *Copy the code

$RVM install 2.3.0

*② Error message: *Copy the code

The Error running ‘requirements_osx_brew_update_system ruby – 2.3.0’, Showing the last 15 lines of/Users/jijiucheng /. RVM/log / 1475769205 _ruby – 2.3.0 / update_system. The log… . Requirements installation failed with status: 1.

Copy the code

curl: (35) Server aborted the SSL handshake

! Error message 1.png (http://upload-images.jianshu.io/upload_images/711060-10e836d4)fc9eecfa.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ! Error message 2.png (http://upload-images.jianshu.io/upload_images/711060-53fd622f1b0feb16.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *③ VPN is recommended to ensure line stability. '<p> *④ Solution (input instructions line by line) : *Copy the code

$ cd /usr/local

Copy the code

$ git remote set-url origin git://mirrors.ustc.edu.cn/brew.git

Copy the code

$ echo ‘export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles’ >> ~/.bashrc

! [solution.png](http://upload-images.jianshu.io/upload_images/711060-e53b3d21011be5fe.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *⑤ * [solutions to link - https://segmentfault.com/q/1010000004276750] * * an error (https://segmentfault.com/q/1010000004276750) - 2: * * * * (1) the Error running'__rvm_make -j 1', 
showing last 15 lines of /Users/jijiucheng/.rvm/log/1475769349_ruby-2.3.0/make. Log ** > *Copy the code

$RVM install 2.3.0

*② Error message: *Copy the code

Error running ‘__rvm_make -j 1’, Showing the last 15 lines of/Users/jijiucheng /. RVM/log / 1475769349 _ruby – 2.3.0 / make. The log… . There has been an error while running make. Halting the installation.

! PNG error message (http://upload-images.jianshu.io/upload_images/711060-2b536f8210eadeb9.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *③commandLine '<p> *④Copy the code

$ xcode-select –install

! [solution.png](http://upload-images.jianshu.io/upload_images/711060-5b7b4c3da30fd277.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *⑤ * [Solution solution link 1 - http://stackoverflow.com/questions/35228481/error-running-rvm-make-install](http://stackoverflow.com/questions/35228481/ error-running-rvm-make-install http://www.th7.cn/Program/Ruby/201609/966343.shtml] * * an error (http://www.th7.cn/Program/Ruby/201609/966343.shtml) - 3: * * * * (1) Gemset' ' does not exist, 'RVM ruby-2.3.0 do RVM gemset create' first, or append '--create'. ** > *① Error command: *Copy the code

$RVM install 2.3.0

*② Error message: *Copy the code

Muxuguixiandemacbook-pro: Local jijiucheng$RVM install 2.3.0 Already installed ruby-2.3.0. RVM Scandisk ruby 2.3.0. Gemset ” does not exist, ‘RVM Ruby-2.3.0 do RVM Gemset create’ first, or append ‘–create’.

! PNG error message (http://upload-images.jianshu.io/upload_images/711060-85ed75cf008139b9.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *③ '<p> *④ Solution: *Copy the code

$RVM reinstall ruby – 2.3.0

! [solution.png](http://upload-images.jianshu.io/upload_images/711060-cf2af9da6f2bb499.png? imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) -### 2, Ruby environment setup- ** error: ** -### install CocoaPods
- ### 4. Use CocoaPods configuration** **① Setting up CocoaPods master repo** **② [!]  Unable to add asource with url `https://github.com/CocoaPods/Specs.git` named `master`. You can try adding it manually in~/. Cocoapods /repos' or via 'pod repo add'.** > *Copy the code

$ pod install

*② Error message: *Copy the code

muxuguixiandeMacBook-Pro:NFCustomer jijiucheng$ pod install Setting up CocoaPods master repo [!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named master. You can try adding it manually in ~/.cocoapods/repos or via pod repo add.

! PNG error message (http://upload-images.jianshu.io/upload_images/711060-9775d53e12cb8c56.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) *③ Sudo xcode-select-switch /Applications/ xcode. app sudo xcode-select-switch /Applications/ xcode \ 2.app '<p> *④Copy the code

$ sudo xcode-select -switch /Applications/Xcode.app

! [solution.png](http://upload-images.jianshu.io/upload_images/711060-ed32f3dec2959b43.png? ImageMogr2 /auto-orient/strip% 7cimageview2/2 /w/1240) *⑤ * 'Setting up the CocoaPods master repo indicates that the CocoaPods are downloading its information to ~/. To create a terminal window, entercd~/.cocoapods, press enter, type du -sh * to check the file size, check every few minutes, the final size of the directory is more than 100 M (I have about 800M +), and you are done. '<p> *⑥ Scheme link: * [Solution solution link 1 - How to uninstall the ios development has installed cocoapod] (HTTP: / / http://zhidao.baidu.com/link?url=WZj_AtGSTkdb0J3G09EdHxqNaD6eM6Uf5u-Qp6-SrFbDBUzA5Bhka9qQ_uHQe67 Pn51nww3wrull2vy-nfal8kplqmn_5-ahsyhy6g_8eoa) [solution link 2 - CocoaPods installation and use and problems: Setting up CocoaPods master repo](http://blog.csdn.net/zhangjunjian127/article/details/47954981)# 4. Supplementary information
<p>
- #### 1. Command completion- ** Rvm ** <p>Copy the code

$RVM install 2.3.0 $RVM install 2.3.0 $RVM install 2.3.0 $RVM get stable $RVM use $RVM use $RVM use $RVM use $RVM use $RVM use $RVM use $RVM use $RVM use $RVM Remove the specified Ruby version

Copy the code

$curl – https://get.rvm.io | L bash – s stable # $curl – sSL https://get.rvm.io | install RVM environment stable bash – s – ruby # default installation RVM latest version $curl – sSL https://get.rvm.io | stable bash – s – ruby = # 2.3.0 install RVM specify version $source ~ /. RVM/scripts/RVM # RVM to load

- **② gem library ** <p>Copy the code

$gem source -l $gem sources -a url # Add a gem source (url) $gem sources –add url # add a gem config source $gem sources -r url # delete a gem config source $gem sources $gem update –system # Update Ruby Gems $$gem install rake $gem install rake – $gem install rake $gem install watir -v 1.6.2 # install watir –version 1.6.2 # install watir $gem query -n “[0-9]” –local # search log $gem search log $gem search -r log # Search for log strings from local and remote servers $gem help install $gem help examples $gem help examples Gem $gem check -v PKG /rake-0.4.0.gem # Check whether rake is valid $gem cleanup # Clear all packages of older versions, $gem dependency Rails -v 0.10.1 $sudo gem install cocoa Pods $sudo gem install CocoaPods $sudo gem install CocoaPods $sudo gem install $sudo gem install $sudo gem install $sudo gem install $sudo gem Update Cocoapods $sudo gem Update cocoapods $sudo gem update cocoapods $sudo gem $sudo gem uninstall Cocoapods -v 0.39.0 # Remove the specified version from cocoapods with admin permission

- **③ POD instruction library ** <p>Copy the code

$pod setup # CocoaPods download the information to ~/.cocoapods/repos. If you do not run this command when installing CocoaPods, the first time you run the pod Intall command, $pod –version # Check whether CocoaPods is installed successfully and its version $pod install # Install CocoaPods Podfile



# 5. References
<p>
- ##### : This is a list of articles I installed CocoaPods and referenced when writing this article, if there are copyright issues, please contact me, I will delete.< p > - * * * * - 01 [Rvm, Ruby and Cocoapods installation] (http://www.jianshu.com/p/934849a5232a) - * * * * 02 - [Rvm and Ruby installation] (http://www.jianshu.com/p/7fedee946f40) - * * * * - 03 CocoaPods] [iOS library depend on management tool (http://www.jianshu.com/p/0cea9006c0cb) 04 - * * * * - pit] [CocoaPods installation and meet (http://www.cocoachina.com/ios/20160922/17622.html) - * * - * * 05 [ios development how to uninstall already installed cocoapod] (HTTP: / / http://zhidao.baidu.com/link?url=WZj_AtGSTkdb0J3G09EdHxqNaD6eM6Uf5u-Qp6-SrFbDBUzA5Bhka9qQ_uHQe6 7PN51NWW3WRULL2VY-nfal8KPLQmn_5 -ahsYHY6G_8eOa) - **06** - [Before configuring CocoaPods - Locally installed Ruby environment] (http://www.cnblogs.com/cwllong/p/5072882.html) - * * - * * 07 [iOS Learning notes 2 [cocopods installation and the installation process and the solution to the problem of 】 update [20160725]] (http://www.cnblogs.com/boai/p/4977976.html) - * * * * - 08 [ruby study and compile ruby lack of openssl problem solving] (http://www.cnblogs.com/netbuddy/p/3501147.html) < p > - * * * * - 01 [solution to upgrade the EI Capiton CocoaPods"pod: command not found"](http://www.jianshu.com/p/6ff1903c3f11) - **02** - [curl: (35) Server aborted the SSL handshake] (https://segmentfault.com/q/1010000004276750) - * * * * - 03 [the first - Error running'__rvm_make -j 1'] (http://stackoverflow.com/questions/35228481/error-running-rvm-make-install) - * * * * - 04 [the second - Error running'__rvm_make -j 1'](http://www.th7.cn/Program/Ruby/201609/966343.shtml)
- **05** - [[!] Unable to add a source with url "xxxxxxxxxxxxx"](http://zhidao.baidu.com/link?url=WZj_AtGSTkdb0J3G09EdHxqNaD6eM6Uf5u-Qp6-SrFbDBUzA5Bhka9qQ_uHQe67Pn51nWw3wrulL2vy-nfal8 KpLqMN_5-ahsYHY6G_8eOa) - **06** - [Error running'requirements_osx_brew_update_system ruby - 2.0.0 - p643'07] (http://blog.csdn.net/luohancc/article/details/46897247) - * * * * - [about installation cocoapods encountered some pit (ERROR: Error installing cocoapods: Activesupport requires Ruby version > = 2.2)] (http://blog.csdn.net/fairytale_1/article/details/51850734) - * * * * - 08 [Homebrew install: Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1](http://stackoverflow.com/questions/39836190/homebrew-install-failed-during-git-fetch-origin-masterrefs-remote s-origin-mas) - **09** - [Pod /usr/bin/gitclone https://github.com/CocoaPods/Specs.git master](http://www.jianshu.com/p/90ca71b3b94a)


<p>
# 6. Subsequent updates
<p>
- ### 2016.12.15 Issue Updated- ** Install CocoaPods ** >Copy the code

The instructions vary from OS X to OS X: $sudo gem install CocoaPods after OS X 10.11 install CocoaPods from CocoaPods. $ sudo gem install -n /usr/local/bin cocoa pods

② Reasons for change: * A friend said that the commands used in 'MAC OS 10.11' and 'MAC OS 10.12' environments are different. When I wrote this article, the environment was' MAC OS 10.11 ', but there was no 'MAC OS 10.12' environment. Today, I did a test again. The current environment is' MAC OS 10.12.1 '. *! [MAC OS 10.12.1.png](http://upload-images.jianshu.io/upload_images/711060-2a771a61d55e2848.png? ImageMogr2 /auto-orient/strip% 7cimageView2/2 /w/1240) ③ Test result: '----> command: ----> $sudo gem install Cocoa Pods ----> No password required '! $sudo gem install Cocoa Pods test.png (http://upload-images.jianshu.io/upload_images/711060-77bee925cb289a85.png? ImageMogr2 /auto-orient/strip% 7cimageview2/2 /w/1240) '----> command: ----> $sudo gem install cocoapods ----> Need password'! $sudo gem install cocoapods ImageMogr2 /auto-orient/strip% 7cimageview2/2 /w/1240) '----> command: ----> $sudo gem install -n /usr/local/bin Cocoa Pods ----> Need password '! $sudo gem install -n /usr/local/bin Cocoa Pods test results.png](http://upload-images.jianshu.io/upload_images/711060-c9e35cae327c961e.png? ImageMogr2 /auto-orient/strip% 7cImageView2/2 /w/1240) ④ The results show that Cocoapods can be installed successfully, but the contents of the update are slightly different. $sudo gem install cocoapods' ---- <p>### error message board has not been finished, I will continue to improve later when I have time!!
<p>
### If there is any wrong information, I hope you can point it out, and then timely modify, learn from each other!!
<p>
### if reproduced, hope can indicate the source!!
<p>

----
Copy the code