I solved the problem. Here’s the solution if anyone needs it:
- Uninstall the Xcode app
- Remove all trace of the program from the system by deleting the Developer folder from the Library. Read this post for more instructions
- Next, update to the latest version of OSX
- Reinstall Xcode and Developer tools
- Finally, run
gem install cocoapods