CocoaPods is the dependency manager for Objective-C projects. It has thousands of libraries and can help you scale your projects elegantly. It is built with Ruby and is installable with the default Ruby available on OS X. To check ruby version installed on your system, run the following command in Terminal:
$ ruby -v
You’d better update the ruby to latest version using the command:
curl -sSL https://get.rvm.io | bash -s stable --ruby
To install a ruby built application, the RubyGems software also called “gem” can be used
$ sudo gem install cocoapods
You’re almost done and now can sit back relax and see the successful command execution similar to the following:
Password:******* Fetching: i18n-0.6.11.gem (100%) Successfully installed i18n-0.6.11 Fetching: multi_json-1.10.1.gem (100%) Successfully installed multi_json-1.10.1 Fetching: activesupport-3.2.19.gem (100%) Successfully installed activesupport-3.2.19 Fetching: nap-0.8.0.gem (100%) Successfully installed nap-0.8.0 Fetching: json_pure-1.8.1.gem (100%) Successfully installed json_pure-1.8.1 Fetching: fuzzy_match-2.0.4.gem (100%) Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-0.33.1.gem (100%) Successfully installed cocoapods-core-0.33.1 Fetching: claide-0.6.1.gem (100%) Successfully installed claide-0.6.1 Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: xcodeproj-0.17.0.gem (100%) Building native extensions. This could take a while… [!] You are using the prebuilt binary version of the xcodeproj gem. Successfully installed xcodeproj-0.17.0 Fetching: cocoapods-downloader-0.6.1.gem (100%) Successfully installed cocoapods-downloader-0.6.1 Fetching: cocoapods-plugins-0.2.0.gem (100%) Successfully installed cocoapods-plugins-0.2.0 Fetching: cocoapods-try-0.3.0.gem (100%) Successfully installed cocoapods-try-0.3.0 Fetching: netrc-0.7.7.gem (100%) Successfully installed netrc-0.7.7 Fetching: cocoapods-trunk-0.1.4.gem (100%) Successfully installed cocoapods-trunk-0.1.4 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: open4-1.3.4.gem (100%) Successfully installed open4-1.3.4 Fetching: cocoapods-0.33.1.gem (100%)CHANGELOG: ## 0.33.1 ##### Bug Fixes * Fix `pod spec lint` for `json` podspecs. [Fabio Pelosin][irrationalfab] [#2157](https://github.com/CocoaPods/CocoaPods/issues/2157) * Fixed downloader issues related to `json` podspecs. [Fabio Pelosin][irrationalfab] [#2158](https://github.com/CocoaPods/CocoaPods/issues/2158) * Fixed `–no-ansi` flag in help banners. [Fabio Pelosin][irrationalfab] [#34](https://github.com/CocoaPods/CLAide/issues/34) Successfully installed cocoapods-0.33.1 Parsing documentation for i18n-0.6.11 Installing ri documentation for i18n-0.6.11 Parsing documentation for multi_json-1.10.1 Installing ri documentation for multi_json-1.10.1 Parsing documentation for activesupport-3.2.19 unable to convert “x80″ from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping Installing ri documentation for activesupport-3.2.19 Parsing documentation for nap-0.8.0 Installing ri documentation for nap-0.8.0 Parsing documentation for json_pure-1.8.1 Installing ri documentation for json_pure-1.8.1 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-0.33.1 Installing ri documentation for cocoapods-core-0.33.1 Parsing documentation for claide-0.6.1 Installing ri documentation for claide-0.6.1 Parsing documentation for colored-1.2 Installing ri documentation for colored-1.2 Parsing documentation for xcodeproj-0.17.0 Installing ri documentation for xcodeproj-0.17.0 Parsing documentation for cocoapods-downloader-0.6.1 Installing ri documentation for cocoapods-downloader-0.6.1 Parsing documentation for cocoapods-plugins-0.2.0 Installing ri documentation for cocoapods-plugins-0.2.0 Parsing documentation for cocoapods-try-0.3.0 Installing ri documentation for cocoapods-try-0.3.0 Parsing documentation for netrc-0.7.7 Installing ri documentation for netrc-0.7.7 Parsing documentation for cocoapods-trunk-0.1.4 Installing ri documentation for cocoapods-trunk-0.1.4 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for open4-1.3.4 Installing ri documentation for open4-1.3.4 Parsing documentation for cocoapods-0.33.1 Installing ri documentation for cocoapods-0.33.1 18 gems installed
And when new version is available, it is notified in terminal upon executing the command ($ pod install) as (CocoaPods 0.34.2 is available) so same install command can be used to update it.
$ sudo gem install cocoapods
Now that you know how to install cocoapods, you would like to use iOS Libraries via cocoapods.