无法升级过去的 CocoaPods 0.39.0

Cannot upgrade past CocoaPods 0.39.0

我正在尝试升级到 CocoaPods 1.2.1,但无法卸载 CocoaPods 0.39.0。

我已经查看了很多关于这个问题的帖子。显然 0.39.0 引起了很多问题。我没有足够的信誉点来附加我审查过的所有链接,但有几个 Whosebug 问题和 GitHub 问题,因为 v.0.39.0 显然有一些问题。以下是我评论的众多帖子中的两个:

堆栈溢出问题: Cocoa Pods need to completely re-install

COCOAPODS 博客 POST 关于分片和 v.0.39.0: http://blog.cocoapods.org/Sharding/

这是我的 'gem env' 输出:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.12
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: 
/Users/johndoe/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/johndoe/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/johndoe/.rbenv/versions/2.3.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/johndoe/.rbenv/versions/2.3.1/bin
  - SPEC CACHE DIRECTORY: /Users/johndoe/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: 
/Users/johndoe/.rbenv/versions/2.3.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/johndoe/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
     - /Users/johndoe/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/johndoe/.rbenv/versions/2.3.1/bin
     - /usr/local/Cellar/rbenv/1.1.1/libexec
     - /usr/local/bin
     - /usr/local/sbin
     - /Users/johndoe/.rbenv/shims
     - /Users/johndoe/.rbenv/shims
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Applications/Postgres.app/Contents/Versions/latest/bin
     - /Users/johndoe/.rbenv/versions/2.3.1/bin

这是我的 'gem list --local | grep cocoapods' 输出:

cocoapods (1.2.1)
cocoapods-core (1.2.1, 1.2.0, 0.39.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3, 0.9.3)
cocoapods-plugins (1.0.0, 0.4.2)
cocoapods-search (1.0.0, 0.1.0)
cocoapods-stats (1.0.0, 0.6.2)
cocoapods-trunk (1.2.0, 0.6.4)
cocoapods-try (1.1.0, 0.5.1)

我尝试了以下解决方案:

1) "sudo gem uninstall cocoapods" 然后 "sudo gem install cocoapods" 并在每个步骤后关闭并重新打开终端

2) 我修改了我的 .bash_profile 以确保我的 echo $PATH 包含 - EXECUTABLE DIRECTORY: 来自我的 gem env

3) 尝试过 "gem pristine --all"

4) 确保我的自制啤酒是最新的

5) 重新安装了 rbenv

6) 尝试了各种组合:

$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
$ sudo rm -fr Pods/

然后卸载并重新安装 cocoapods…

7) 对我的“gem list --local | ”输出中的每个元素手动应用“sudo gem uninstall” grep cocoapods”然后……

rm -rf ~/.cocoapods/repos/master
sudo gem install cocoapods

8) 尝试过 $ sudo gem 更新 cocoapods

9) 我尝试过: sudo gem 安装 cocoapods:1.2.1

但是当我尝试

pod _1.2.1_ version 

pod —version

它说 0.39.0

10)“which pod”的输出是: /usr/local/bin/pod

11) 我不记得我第一次尝试“sudo gem uninstall cocoapods”时是否给了我专门卸载 0.39.0 的选项。尽管如此,我还是选择了“所有版本”

12) 我尝试了“sudo chown -R "$(whoami)" /usr/local/Cellar/rbenv” 来确保这不是权限问题

13) 我正在使用 Mac OS Sierra 10.12.5

任何帮助将不胜感激!帮忙!?!

我的问题的解决方案是:

sudo gem install -n /usr/local/bin cocoapods

这是我摆脱 0.39.0 并安装最新版本 CocoaPods 的唯一方法...

我在以下 link 找到了这个解决方案以及为什么这是一个问题的解释:

https://github.com/CocoaPods/CocoaPods/issues/3736

万岁!