Install CocoaPods

Make sure the latest ruby stable version installed on your Mac based on your MacOS version. Check the version using following command.

$ ruby --version                                                                  ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]

If the ruby version is not the latest or you receive ruby command not found, visit Install Ruby page to install ruby.

To install cocoapods use following command to install it using gem.

$ sudo gem install cocoapods

Here is a sample result of cocoapods successful installation

Fetching tzinfo-1.2.6.gem
 Fetching thread_safe-0.3.6.gem
 Fetching concurrent-ruby-1.1.6.gem
 Fetching i18n-0.9.5.gem
 Fetching activesupport-4.2.11.1.gem
 Fetching nap-1.1.0.gem
 Fetching fuzzy_match-2.0.4.gem
 Fetching httpclient-2.8.3.gem
 Fetching algoliasearch-1.27.1.gem
 Fetching ffi-1.12.2.gem
 Fetching ethon-0.12.0.gem
 Fetching typhoeus-1.3.1.gem
 Fetching netrc-0.11.0.gem
 Fetching cocoapods-core-1.9.1.gem
 Fetching claide-1.0.3.gem
 Fetching cocoapods-deintegrate-1.0.4.gem
 Fetching cocoapods-downloader-1.3.0.gem
 Fetching cocoapods-plugins-1.0.0.gem
 Fetching cocoapods-search-1.0.0.gem
 Fetching cocoapods-stats-1.1.0.gem
 Fetching cocoapods-trunk-1.4.1.gem
 Fetching cocoapods-try-1.1.0.gem
 Fetching molinillo-0.6.6.gem
 Fetching atomos-0.1.3.gem
 Fetching CFPropertyList-3.0.2.gem
 Fetching colored2-3.1.2.gem
 Fetching nanaimo-0.2.6.gem
 Fetching xcodeproj-1.15.0.gem
 Fetching escape-0.0.4.gem
 Fetching fourflusher-2.3.1.gem
 Fetching gh_inspector-1.1.3.gem
 Fetching ruby-macho-1.4.0.gem
 Fetching cocoapods-1.9.1.gem
 Successfully installed thread_safe-0.3.6
 Successfully installed tzinfo-1.2.6
 Successfully installed concurrent-ruby-1.1.6
 Successfully installed i18n-0.9.5
 Successfully installed activesupport-4.2.11.1
 Successfully installed nap-1.1.0
 Successfully installed fuzzy_match-2.0.4
 Successfully installed httpclient-2.8.3
 Successfully installed algoliasearch-1.27.1
 Building native extensions. This could take a while…
 Successfully installed ffi-1.12.2
 Successfully installed ethon-0.12.0
 Successfully installed typhoeus-1.3.1
 Successfully installed netrc-0.11.0
 Successfully installed cocoapods-core-1.9.1
 Successfully installed claide-1.0.3
 Successfully installed cocoapods-deintegrate-1.0.4
 Successfully installed cocoapods-downloader-1.3.0
 Successfully installed cocoapods-plugins-1.0.0
 Successfully installed cocoapods-search-1.0.0
 Successfully installed cocoapods-stats-1.1.0
 Successfully installed cocoapods-trunk-1.4.1
 Successfully installed cocoapods-try-1.1.0
 Successfully installed molinillo-0.6.6
 Successfully installed atomos-0.1.3
 Successfully installed CFPropertyList-3.0.2
 Successfully installed colored2-3.1.2
 Successfully installed nanaimo-0.2.6
 Successfully installed xcodeproj-1.15.0
 Successfully installed escape-0.0.4
 Successfully installed fourflusher-2.3.1
 Successfully installed gh_inspector-1.1.3
 Successfully installed ruby-macho-1.4.0
 Successfully installed cocoapods-1.9.1
 Parsing documentation for thread_safe-0.3.6
 Installing ri documentation for thread_safe-0.3.6
 Parsing documentation for tzinfo-1.2.6
 Installing ri documentation for tzinfo-1.2.6
 Parsing documentation for concurrent-ruby-1.1.6
 Installing ri documentation for concurrent-ruby-1.1.6
 Parsing documentation for i18n-0.9.5
 Installing ri documentation for i18n-0.9.5
 Parsing documentation for activesupport-4.2.11.1
 Installing ri documentation for activesupport-4.2.11.1
 Parsing documentation for nap-1.1.0
 Installing ri documentation for nap-1.1.0
 Parsing documentation for fuzzy_match-2.0.4
 Installing ri documentation for fuzzy_match-2.0.4
 Parsing documentation for httpclient-2.8.3
 Installing ri documentation for httpclient-2.8.3
 Parsing documentation for algoliasearch-1.27.1
 Installing ri documentation for algoliasearch-1.27.1
 Parsing documentation for ffi-1.12.2
 Installing ri documentation for ffi-1.12.2
 Parsing documentation for ethon-0.12.0
 Installing ri documentation for ethon-0.12.0
 Parsing documentation for typhoeus-1.3.1
 Installing ri documentation for typhoeus-1.3.1
 Parsing documentation for netrc-0.11.0
 Installing ri documentation for netrc-0.11.0
 Parsing documentation for cocoapods-core-1.9.1
 Installing ri documentation for cocoapods-core-1.9.1
 Parsing documentation for claide-1.0.3
 Installing ri documentation for claide-1.0.3
 Parsing documentation for cocoapods-deintegrate-1.0.4
 Installing ri documentation for cocoapods-deintegrate-1.0.4
 Parsing documentation for cocoapods-downloader-1.3.0
 Installing ri documentation for cocoapods-downloader-1.3.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.1.0
 Installing ri documentation for cocoapods-stats-1.1.0
 Parsing documentation for cocoapods-trunk-1.4.1
 Installing ri documentation for cocoapods-trunk-1.4.1
 Parsing documentation for cocoapods-try-1.1.0
 Installing ri documentation for cocoapods-try-1.1.0
 Parsing documentation for molinillo-0.6.6
 Installing ri documentation for molinillo-0.6.6
 Parsing documentation for atomos-0.1.3
 Installing ri documentation for atomos-0.1.3
 Parsing documentation for CFPropertyList-3.0.2
 Installing ri documentation for CFPropertyList-3.0.2
 Parsing documentation for colored2-3.1.2
 Installing ri documentation for colored2-3.1.2
 Parsing documentation for nanaimo-0.2.6
 Installing ri documentation for nanaimo-0.2.6
 Parsing documentation for xcodeproj-1.15.0
 Installing ri documentation for xcodeproj-1.15.0
 Parsing documentation for escape-0.0.4
 Installing ri documentation for escape-0.0.4
 Parsing documentation for fourflusher-2.3.1
 Installing ri documentation for fourflusher-2.3.1
 Parsing documentation for gh_inspector-1.1.3
 Installing ri documentation for gh_inspector-1.1.3
 Parsing documentation for ruby-macho-1.4.0
 Installing ri documentation for ruby-macho-1.4.0
 Parsing documentation for cocoapods-1.9.1
 Installing ri documentation for cocoapods-1.9.1
 Done installing documentation for thread_safe, tzinfo, concurrent-ruby, i18n, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, cocoapods-trunk, cocoapods-try, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 41 seconds
 33 gems installed

Use following command, you can check the version cocoapods

$ pod --version
1.9.1