Unable to sync ios after upgrading from capacitor v5 to v6

I recently upgraded the capacitor libraries from v5 to v6. It used to work find in v5 but after upgradation the command fails while running “ionic cap sync”. Below is the detailed error message

[capacitor] ✖ Updating iOS native dependencies with bundle exec pod install - failed!
[capacitor] ✖ update ios - failed!
[capacitor] [error] /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/definition.rb:594:in `materialize': Could not find fastlane-2.220.0, CFPropertyList-3.0.7, artifactory-3.0.17, aws-sdk-s3-1.151.0, babosa-1.0.4, colored-1.2, commander-4.6.0, dotenv-2.8.1, emoji_regex-3.2.3, excon-0.110.0, faraday-1.10.3, faraday-cookie_jar-0.0.7, faraday_middleware-1.2.0, fastimage-2.3.1, google-apis-androidpublisher_v3-0.54.0, google-apis-playcustomapp_v1-0.13.0, google-cloud-env-1.6.0, google-cloud-storage-1.47.0, highline-2.0.3, http-cookie-1.0.5, json-2.7.2, jwt-2.8.1, mini_magick-4.12.0, multipart-post-2.4.1, naturally-2.2.1, optparse-0.5.0, plist-3.7.1, rubyzip-2.3.2, security-0.1.5, simctl-1.6.10, terminal-notifier-2.0.0, terminal-table-3.0.2, tty-screen-0.8.2, tty-spinner-0.9.3, word_wrap-1.0.0, xcpretty-0.3.0, xcpretty-travis-formatter-1.0.1, nkf-0.2.0, rexml-3.2.8, aws-sdk-core-3.196.1, aws-sdk-kms-1.81.0, aws-sigv4-1.8.0, faraday-em_http-1.0.0, faraday-em_synchrony-1.0.0, faraday-excon-1.1.0, faraday-httpclient-1.0.1, faraday-multipart-1.0.4, faraday-net_http-1.0.1, faraday-net_http_persistent-1.2.0, faraday-patron-1.0.0, faraday-rack-1.0.0, faraday-retry-1.0.3, google-apis-core-0.11.3, digest-crc-0.6.5, google-apis-iamcredentials_v1-0.17.0, google-apis-storage_v1-0.31.0, google-cloud-core-1.7.0, googleauth-1.8.1, mini_mime-1.1.5, domain_name-0.6.20240107, unicode-display_width-2.5.0, tty-cursor-0.7.1, rouge-2.0.7, activesupport-7.1.3.3, strscan-3.1.0, aws-eventstream-1.3.0, aws-partitions-1.931.0, jmespath-1.6.2, representable-3.2.0, retriable-3.1.2, rake-13.2.1, google-cloud-errors-1.4.0, multi_json-1.15.0, os-1.1.4, signet-0.19.0, bigdecimal-3.1.8, drb-2.2.1, i18n-1.14.5, minitest-5.23.0, declarative-0.0.20, trailblazer-option-0.1.2, uber-0.1.0 in locally installed gems (Bundler::GemNotFound)
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/definition.rb:193:in `specs'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/definition.rb:259:in `specs_for'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/runtime.rb:18:in `setup'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler.rb:163:in `setup'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in `block in <top (required)>'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:159:in `with_level'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/ui/shell.rb:111:in `silence'
[capacitor]         from /Users/user1/.rvm/rubies/ruby-3.0.7/lib/ruby/gems/3.0.0/gems/bundler-2.5.11/lib/bundler/setup.rb:29:in `<top (required)>'
[capacitor]         from <internal:/opt/homebrew/Cellar/ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
[capacitor]         from <internal:/opt/homebrew/Cellar/ruby/3.3.2/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
[capacitor]         from /opt/homebrew/Cellar/ruby/3.3.2/lib/ruby/3.3.0/rubygems.rb:1389:in `<top (required)>'
[capacitor]         from <internal:gem_prelude>:2:in `require'
[capacitor]         from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
[capacitor]         
[ERROR] An error occurred while running subprocess capacitor.

Any help is highly appreciated

That’s a CocoaPods or ruby error, Capacitor 6 doesn’t have any changes related to CocoaPods or ruby.

Did you also do a computer OS update?

Between capacitor 5 to 6 upgrade, no OS update was made

I resolved this issue by just using a later version of ruby using rvm, previous it was using ruby version that comes default in the system(Mac M1)- 2.x

  1. Use later version of ruby

rvm use ruby-3.3.2

  1. Create a config.txt in my .bundle folder in home directory. The config.txt should have the following content

BUNDLE_PATH: “…/.gem”

Ensure that the .gem folder path is valid and has gems installed

  1. Install the missing gems that is reported in the error, for example

gem install “gem_name” -v “gem_version”