rnoodle
rnoodle

Reputation: 584

Install a version of cocoapods but `pod --version` resolves to an older version

I have a clean sequoia 15.2 mac M4 with an old react-native (v 0.71.19) project. The project has a Gemfile (specifying ruby 2.7.6) in its root with a Gemfile.lock (specifying ruby 2.7.6p219 and cocoapods 1.15.2).

I would like to build the project before upgrading any components. Therefore I need to install ruby 2.7.6 and cocoapods 1.15.2.

$ \curl -sSL https://get.rvm.io | bash -s stable
$ PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig rvm install 2.7.6 --with-openssl-lib=$(brew --prefix [email protected]) --with-openssl-include=$(brew --prefix [email protected])
$ gem install cocoapods -v 1.15.2

Between each of the commands I have updated .zshrc with the required PATH modifications for rvm etc. and refreshed the terminal. I am using rvm to manage different versions of ruby and I do not want to use homebrew.

However, after installing cocoapods 1.15.2 with the above commands, then pod --version resolves to 1.14.3, thus I get a warning when trying to build the project's pods (we need 1.15.2).

I have tried everything (using sudo gem install, gemsets, cleaning and reinstalling rvm/ruby/cocoapods, pod update, pod install --repo-update etc.) but I cannot get the pod command to resolve to 1.15.2. If I install the latest cocoapods, it still resolves to 1.14.3.

Running gem env shows that the correct ruby version is being referenced from rvm. Running gem list shows

$ gem list cocoapods
cocoapods (1.15.2)
cocoapods-core (1.15.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)

which doesn't reference 1.14.3. However, pod env does reference 1.14.3

$ $(which pod) env

### Stack

   CocoaPods : 1.14.3
        Ruby : ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin24]
    RubyGems : 3.1.6
        Host : macOS 15.2 (24C101)
       Xcode : 16.2 (16C5032a)
         Git : git version 2.39.5 (Apple Git-154)
Ruby lib dir : /Users/<username>/.rvm/rubies/ruby-2.7.6/lib

I understand that the preinstalled system ruby 2.6.0 may sometimes cause an issue, but I am sure after inspecting the above configurations, ruby 2.6.7 is being used. There are no homebrew ruby installs.

Upvotes: 0

Views: 64

Answers (0)

Related Questions