Cocoapods installation failed, Failed to build gem native extension
I fixed it by running
brew install cocoapods
AndYou may want to remove it:
rm '/usr/local/bin/pod'
To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
Install homebrew if you haven't already. https://brew.sh/