Cocoapods points to wrong version
Asked Answered
G

8

7

I had some problems with one version of the project. I've found this answer where someone suggest steps to remove all cocoapods-connected stuff from the machine and reinstall it. I did follow the steps:

$ 'pod --version'
0.36.1

$ gem list --local | grep cocoapods
cocoapods (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-core (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-downloader (0.9.3, 0.9.1)
cocoapods-plugins (0.4.2)
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2, 0.5.3)
cocoapods-trunk (0.6.4, 0.6.1)
cocoapods-try (0.5.1, 0.4.5)

$ gem uninstall cocoapods // and all others from the list above

The problem is that when i again grep all cocoapods, the list was equal to upper one, nothing disappeared.

$ sudo gem uninstall cocoapods
Select gem to uninstall:
 1. cocoapods-0.37.2
 2. cocoapods-0.38.1
 3. cocoapods-0.38.2
 4. cocoapods-0.39.0.rc.1
 5. All versions
> 5

$ pod --version
// here was the error command not found, so everything fine

$ sudo gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
Successfully installed cocoapods-0.38.2
Parsing documentation for cocoapods-0.38.2
Installing ri documentation for cocoapods-0.38.2
Done installing documentation for cocoapods after 2 seconds
1 gem installed

$ pod --version
Could not find proper version of cocoapods (0.36.1) in any of the sources
Run `bundle install` to install missing gems.

But why does it want me to install 0.36.1? Anyway, as it asked, I did:

$bundle install
Installing cocoapods-core 0.36.1
Installing cocoapods-downloader 0.8.1
Installing cocoapods-plugins 0.4.1
Installing cocoapods-trunk 0.6.0
Installing cocoapods-try 0.4.3
Installing cocoapods 0.36.1
// Many "using" dependencies

So now when I run:

$ pod --version
0.36.1

And I'm stuck :) Why can't I have newest release version? Maybe pod --version points to the newest version of cocoapods-core instead of only cocoapods, so everything is ok and I have the correct version?

Galloping answered 6/10, 2015 at 8:57 Comment(1)
I needed to downgrade cocoapods: #20488349Characteristically
G
2

It seems something got messed up in my ruby version. I still have no idea what and why. I've managed to fix it via this solution: https://mcmap.net/q/1475884/-cocoa-pods-need-to-completely-re-install. After it everything works correctly.

Galloping answered 6/10, 2015 at 12:31 Comment(1)
Try bundle install first, then you can run pod install again.Birthday
B
7
  • Check if you use Gemfile and there is specified the version of cocoapods.
  • You can use specific version by pod *version* action. For example: pod _1.5.0.beta.1_ update or pod _1.5.0.beta.1_ install
Badderlocks answered 26/3, 2018 at 12:19 Comment(3)
This question is 3 years old and I don't remember the context. But looking at my accepted answer, which had to fix the issue, I rather claim it was a bug in some cache of ruby on my machine. Anyway, for most cases you have a good direction, it could be in a Gemfile (what suggests the output in console "Run bundle install"). But I don't think your 2nd point would work, if someone has a version specified in Gemfile he should update Gemfile. Installing specific version of cocoapods wouldn't help, because Gemfile would force the previous one. So, future reader, update cocopods version in GemfileGalloping
Thanks for this answer; helped a lot. I didn't realize my Gemfile was looking for a specific (and older) version of Cocoapods. I deleted Gemfile.lock, reinstalled my pods, and it worked. Phew!Rhoades
yes deleting Gemfile.lock and running "pod install" fix the problem.. atlast build fine. even pod --version was showing previous version although I had installed new cocoapod verion.. phewShiekh
L
6

I ran pod install and I've got this error:

Could not find proper version of cocoapods (1.11.3) in any of the sources

and I ran:

bundle install

after that pod install worked properly

Lachrymator answered 19/4, 2022 at 13:24 Comment(2)
I am getting this error when trying bundle install An error occurred while installing ffi (1.15.5), and Bundler cannot continue. Make sure that `gem install ffi -v '1.15.5' --source 'https://rubygems.org/'` succeeds before bundlingOdilia
had to remove Gemfile.lock before running bundle installMacfarlane
L
4

For anyone coming to this in an attempt to update cocoapods. After doing all of the above I wasn't able to get this resolved. I then headed to the resolved answer and being unwilling to remove RVM, I tried to resolve this issue another way.

I found that my issue did indeed lie in my Gemfile.

First, run gem install cocoapods to ensure you have the latest version, or whatever specified version you were looking for downloaded.

Second, ensure your projects Gemfile hasn't specified a cocoapods version number and instead simply specifies it as: gem "cocoapods" If yours doesn't, change this and run bundle update to regenerate the Gemfile.lock file and your problem should be solved. If not, go ahead and delete the Gemfile.lock file altogether and then run bundle update. You can easily check to see which gem version will be loaded by opening the Gemfile.lock file and searching for cocoapods-core <version number here>

At this point, you can go into your project and run pod setup and then check the cocoapods version with pod --version

and now FINALLY you are free to run pod install to replace the Podfile.lock file and get back to your happy dev life. Hope that helps someone and saves them from burning hours.

Leninism answered 20/12, 2018 at 20:49 Comment(0)
G
2

It seems something got messed up in my ruby version. I still have no idea what and why. I've managed to fix it via this solution: https://mcmap.net/q/1475884/-cocoa-pods-need-to-completely-re-install. After it everything works correctly.

Galloping answered 6/10, 2015 at 12:31 Comment(1)
Try bundle install first, then you can run pod install again.Birthday
C
1

You might face this issue when it comes migrating to a higher Swift version. Assuming that you already have cocoapods installed, you probably need to run bundle update command (possibly with sudo).

For more details, you could check: https://guides.cocoapods.org/using/a-gemfile.html

Additionally, I'd suggest to do the following:

  • Install the latest Xcode version.
  • Clear derived data (not just clean project) in your project.
  • Run pod update command.
Centonze answered 30/7, 2019 at 12:44 Comment(2)
Looking at the year, I guess the project was objective-c only, but I don't remember already. Surely all of the actions you wrote above did not help, I highly doubt I could not try those steps. Hope it helps someone else though :-)Galloping
@Vive I preferred to share it because I faced the issue and resolved it by doing what I mentioned. I agree with you, hope that someone else get the benefit of it 🙂Centonze
M
1

I have the same problem.

In my project, pod --version and gem which cocoapods always return diffrence version.

All I had to do is remove Gemfile.lock in my project and bundle install again. It removed the locked cocoapods version and install a new one.

Hope that helps some one here.

Mantis answered 30/9, 2021 at 2:10 Comment(0)
T
0

This is because the cocoapods version in the gem lock file is different than the one installed. You may have multiple installed.

Delete the cocoapod version using gem uninstall cocoapods

Then use bundle update to update your lock file to the correct version.

Then use bundle install if necessary to install it to the correct version.

Thorax answered 6/4, 2023 at 3:48 Comment(0)
S
0
  1. rm -rf ~/.rvm
  2. reopen terminal window
  3. do the dance
Sastruga answered 21/7, 2023 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.