Cocoapods are dependency manager for Swift and Objective-C that maintains external libraries. I had to install this to make use of AWS libraries for iOS application.
This can be installed with the Ruby which is already available on OS X El Capitan. The installing process seem to be simple as mentioned in their official website, but I faced a couple of issues which I wanted to share, so it saves time for others who faces similar issues.
First, I updated the Ruby version. Open terminal, type the below command.
$ sudo gem update --system
Then, run the command to install Cocoapods.
$ sudo gem install cocoapods
This will ask you to enter the password. Once I typed in my mac login password and hit enter, it threw me the below error.
ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
After googling this for a while, I ran this command (not sure if this is necessary).
$ sudo gem install activesupport -v 4.2.6
After it installed active support version 4.2.6, I ran the cocoapod installation command again which gave me another error.
$ sudo gem install cocoapods Fetching: nap-1.1.0.gem (100%) Successfully installed nap-1.1.0 Fetching: fuzzy_match-2.0.4.gem (100%) ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/fuzzy_match
After reading a few forums, I found there is a problem with OS X El Caption which has access issues to system, so I was suggested to run this for a specific user folder.
$ sudo gem install cocoapods -n /usr/local/bin Password: Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-1.0.1.gem (100%) Successfully installed cocoapods-core-1.0.1 Fetching: claide-1.0.0.gem (100%) Successfully installed claide-1.0.0 Fetching: cocoapods-deintegrate-1.0.0.gem (100%) Successfully installed cocoapods-deintegrate-1.0.0 Fetching: cocoapods-downloader-1.1.0.gem (100%) Successfully installed cocoapods-downloader-1.1.0 Fetching: cocoapods-plugins-1.0.0.gem (100%) Successfully installed cocoapods-plugins-1.0.0 Fetching: cocoapods-search-1.0.0.gem (100%) Successfully installed cocoapods-search-1.0.0 Fetching: cocoapods-stats-1.0.0.gem (100%) Successfully installed cocoapods-stats-1.0.0 Fetching: netrc-0.7.8.gem (100%) Successfully installed netrc-0.7.8 Fetching: cocoapods-trunk-1.0.0.gem (100%) Successfully installed cocoapods-trunk-1.0.0 Fetching: cocoapods-try-1.1.0.gem (100%) Successfully installed cocoapods-try-1.1.0 Fetching: molinillo-0.4.5.gem (100%) Successfully installed molinillo-0.4.5 Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: xcodeproj-1.2.0.gem (100%) Successfully installed xcodeproj-1.2.0 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: fourflusher-0.3.2.gem (100%) Successfully installed fourflusher-0.3.2 Fetching: cocoapods-1.0.1.gem (100%) Successfully installed cocoapods-1.0.1 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-1.0.1 Installing ri documentation for cocoapods-core-1.0.1 Parsing documentation for claide-1.0.0 Installing ri documentation for claide-1.0.0 Parsing documentation for cocoapods-deintegrate-1.0.0 Installing ri documentation for cocoapods-deintegrate-1.0.0 Parsing documentation for cocoapods-downloader-1.1.0 Installing ri documentation for cocoapods-downloader-1.1.0 Parsing documentation for cocoapods-plugins-1.0.0 Installing ri documentation for cocoapods-plugins-1.0.0 Parsing documentation for cocoapods-search-1.0.0 Installing ri documentation for cocoapods-search-1.0.0 Parsing documentation for cocoapods-stats-1.0.0 Installing ri documentation for cocoapods-stats-1.0.0 Parsing documentation for netrc-0.7.8 Installing ri documentation for netrc-0.7.8 Parsing documentation for cocoapods-trunk-1.0.0 Installing ri documentation for cocoapods-trunk-1.0.0 Parsing documentation for cocoapods-try-1.1.0 Installing ri documentation for cocoapods-try-1.1.0 Parsing documentation for molinillo-0.4.5 Installing ri documentation for molinillo-0.4.5 Parsing documentation for colored-1.2 Installing ri documentation for colored-1.2 Parsing documentation for xcodeproj-1.2.0 Installing ri documentation for xcodeproj-1.2.0 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for fourflusher-0.3.2 Installing ri documentation for fourflusher-0.3.2 Parsing documentation for cocoapods-1.0.1 Installing ri documentation for cocoapods-1.0.1 17 gems installed
That worked for me. Now, you can install the external libraries in your projects.