$ sudo gem install cocoapods
curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
sudo gem update
sudo gem install ffi
brew install libffi
sudo gem install cocoapods
pod setup
If with sudo its failing,First download and install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
step 1 brew install cocoapods
step 2 sudo arch -x86_64 gem install ffi
step 3 arch -x86_64 pod install