Cocoapods — install tutorial

Cocoapods is a strong and convenient third-party library manage tool for swift and object-c developing environment, in this topic, if you want to learn more about cocoapods, you can see the following website: https://cocoapods.org.

In this topic, I will teach you how to install Cocoapods step by step, if you have any problem, you can message me and we can discuss together.

My address: imbearfly@gmail.com

Step 1: Start you terminal and Install ruby 2.2.2

Insert following commands line by line

curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm -v
rvm install 2.2.2

After command install 2.2.2, you will see following info that the system is asking you for your user password, insert your OS password and continue

password required for 'mkdir -p /etc/openssl':

Step 2: Install cocoapods and find the package you want

cocoapods install command:

sudo gem install cocoapods

After succesfully installed cocoapods, goto cocoapods website to get the “name”(all you need is the name of the package) of the package you want >>> https://cocoapods.org.

Step 3: Insert pods to your project

In this step, I will use “SDWWebImage” for example, first find the route of your project and redirect your terminal command the folder of your project file, my route for example: “Documents/PeterPanClass/class13thPrac”

cd Documents/
cd PeterPanClass/
cd class13thPrac/
pod init
vim Podfile

Now you will in the pod editing window, following below steps to install pods.

  1. press button “i” to become insert mode.
  2. paste pod name to the Podfile.
  3. press button “esc” to leave insert mode.
  4. press shift+: to insert command.
  5. insert wq(w means save change, q means quit) to save and quit.

Now you can install to pod to your project by the command below

Pod install

Step 4: Chech if the pod succesfully installed to your project

Now when you want edit your project, open the xcworkspace rather than xcodeproj, you new xcworkspace will looks like this.

And you will find pod documents in your workspace.

If you have any problem or question about this tutorial, email me or send iMessage to my apple id: imbearfly@gmail.com (The iOS developer must using iPhone right?)

Like what you read? Give Fly Hsiung a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.