CocoaPods – Installation

First time I read about CocoaPods, I didn’t think much about it. It said that it’s a the best way to manage Objective-C libraries and the dependencies. Well, I can manage my own library usage myself, no thanks.

Lately I saw many more libraries offer to install via CocoaPods. OK, I’ll give it try, nothing to lose. Let’s install it first.

Installation

The homepage at http://cocoapods.org/ offers simple installation steps. Just open Terminal and hit command:

When I tried it, nothing happen! It’s just blank, no progress/status message, no nothing. So I have to kill it by “ctrl-c”. I have made sure that I have Ruby which is the prerequisite as CocoaPods will run on top of Ruby. After reading CocoaPods issues on GitHub, I found nothing that fits my case. What I should do is find a way to verbose installation so I know what’s wrong.

Then I tried this command:

Viola! It outputs something. Looking at the verbosed messages, turned out it run well all this time, only took time to complete :)

After waiting about 5 minutes, installation was successful! Let’s play around with CocoaPods.

Then when I tried to do “pod setup”, it said:

OK, let’s update the RubyGems then by hitting command:

Don’t forget to use sudo, as it will be failed due to permission issue. Now that the RubyGems was updated, I tried to run “pod setup” again.

Installing Pod

Now I want to install a Pod here. First I create a Podfile, by hitting command from Terminal:

Then a text editor was opened. I input this text:

Save the file and issuing this command at Terminal:

Boom! I got error

Seems my default setting for iOS platform is set to 4.3. Let’s set to iOS 6.0 as required by the Pod I want to install. I edit Podfile again:

Then hit “pod install” again. The messages:

And it’s successful! Yay!

*Note: CollectionViewBlock is my Xcode project. You should do all those commands in the working directory of your Xcode project, I guess :)