Problem building iOS project from Ionic/Capacitor

I’m trying to build an iOS version of an ionic/capacitor app, but there seems to be an issue with updating cocoa pods. Does anyone know how to resolve the following problem?

Error running update: /bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

Here’s my project info:


   Ionic CLI                     : 6.5.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.803.26
   @angular-devkit/schematics    : 8.3.26
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0


   Capacitor CLI   : 2.0.0
   @capacitor/core : 2.0.0


   cordova-res                          : not installed
   native-run (update available: 1.0.0) : 0.2.6


   NodeJS : v12.16.1 (/usr/local/bin/node)
   npm    : 6.13.4
   OS     : macOS Sierra

What steps did you do for the update?

I used $ [sudo] gem install cocoapods

Did you try pod init in your app folder inside the iOS folder?

When I tried pod init inside the iOS folder, I got this error:

bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory

so something is missing from my current version of cocoa pods but I’m having trouble updating to the latest version. I’m going to try uninstalling development tools and starting over…

Try reinstalling, sudo gem install cocoapods

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