brew cleanup -d -v
brew install cocoapods
#Note: If you see failed to link then run
brew link cocoapods
Try with Update ruby
curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.4.1
rvm docs generate-ri
1) Install homebrew via terminal.
2) After homebrew is successfully installed, type in the terminal '$ brew install cocoapods'