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:

   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:

   Capacitor CLI   : 2.0.0
   @capacitor/core : 2.0.0

Utility:

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

System:

   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

1 Like

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
2 Likes

I’ve finally managed to get the iOS build working. For anyone else experiencing this issue, here’s what fixed it for me:

  1. Downgraded Ruby from 2.8.0dev to 2.6.3 using rvm (if you don’t have rvm install it first 'natch):
rvm install "ruby-2.6.3"
  1. Use the new ruby version. Note that in my case this is only active in the same terminal window. As soon as a new window opens, it reverts to the default:
rvm use 2.6.3
  1. This by itself did not fix the issue. So I also downgraded my version of gems from 3.1.2 to 3.0.3 Be sure to do this when using ruby 2.6.3 or it’ll fail :
gem update --system 3.0.3
  1. Still the problem was not resolved, because now cocoapods couldn’t be found. So I also reinstalled cocoapods:
sudo gem uninstall cocoapods
Gem 'cocoapods' is not installed

sudo gem install -n /usr/local/bin cocoapods
  1. Once that was complete I then removed my existing iOS build folder and recreated it:
npx cap add ios
  1. Sit back and pray to Jebus
  2. Great success!
✔ Updating iOS native dependencies with "pod install" (may take several minutes) in 4.14s
✔ update ios in 4.15s

Some of these steps may not have been needed, or could have perhaps been done in a different order, but after days of noodle scratching I’m now finally able to get a build to my device.

Good luck everyone!

2 Likes

Thanks @MarieM71 although I was praying to Jesus while reading your post, at last, you were the one who saved me! :laughing: