Recently I found that a lot of cocoaPods tutorials are not suitable, either there is a problem or there is an error, as a third party things, originally brought convenience, but now it is not convenient, so I have arranged the process from beginning to end for my colleagues to install cocoaPods, I hope to help you;

Install Ruby



Now cocoaPods needs Ruby 2.2.2 or older to work, so we need to update Ruby.



1. Install the Xcode Command line



$ xcode-select --install



2. Install RVM



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



3. Check whether the installation is normal



$ source ~/.bashrc 



$ source ~/.bash_profile



4. View \ list version information



$ ruby -v



$ rvm list known



5. Install ruby



$RVM install 2.3

Copy the code
Install cocoaPods



1. Delete the built-in Ruby source



$ sudo gem sources -r https://rubygems.org/



2. Use taobao's image



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



3. Check whether the replacement is successful



$ gem sources -l



4. Install cocoaPods



$ sudo gem install cocoapods



5. After step 4 is successful, you can enter the following command to check whether cocoaPods version number is available:



pod --version



6. Finally, configure cocoaPods



pod setup



Step 6 will take a long time. You can follow the command below:



cd ~/.cocoapods



du -sh * 



8. Update the gem



$sudo gem update --system

Copy the code

Note: If the pod setup step is stuck for a long time, that is, Setting up the CocoaPods master repo for a long time, we can do this;

1. Download a Github client

2. Open the web site: https://github.com/CocoaPods/Specs

3. Open your Github client, clone it to your desktop and name it master.

  1. Over the long cloning process, I downloaded 809M;

5. After cloning, run the command on your terminal

// Show all the hidden files

defaults write com.apple.finder AppleShowAllFiles -bool true

Copy the code

6. Restart Finder (Command + Option + ESC)

7. Go to your personal folder:

Drag the “master” folder you cloned on your desktop into the “repos” folder

  1. It will soon be installed by executing pod Setup on your terminal.
Use cocoaPods

Q: Exit wq: Save and exit! : Forced meaning I: Enter editing mode

Shift +: : indicates whether you want to perform the exit step or save the exit step

Copy the code

Look at the picture # # # #