Open Terminal
CocoaPods runs on ruby so update your system.

sudo gem update --system

Install CocoaPods

sudo gem install cocoapods

Setup the Pod

pod setup

Note : This process will take some time.

Troubleshoot

Error: Operation not permitted - /usr/bin/xcodeproj

Solution: sudo nvram boot-args="rootless=0"; sudo reboot