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