cocoaPods升级遇到的问题 以及升级ruby 升级cocoaPos 整理

今天从github上下载框架, 发现提示我升级到cocoaPod, 我以前的版本是0.39 , ruby 版本是2.00
正常升级后发现cocoaPods 升级到1.0以上,  ruby的版本必须要升级,  我就把ruby版本升级到了2.2.2
下面是我的步骤, 文章后面是我自己网上查到感觉有对大家有帮助的参考链接.

1.查询 rvm版本
rvm -v

2.查询ruby版本
ruby -v

3.查询 gem 版本
gem -v

4.查询ruby 镜像
gem sources -l

5.升级ruby环境到 2.2.2  ,  
rvm install ruby 2.2.2

6.再次查询 看看升级成功
pengdunshiyoudeiMac:~ pdsy$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
7.查询镜像
pengdunshiyoudeiMac:~ pdsy$ gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org/
8.更换镜像地址 成腾讯云  淘宝镜像好像不行了
pengdunshiyoudeiMac:~ pdsy$ gem sources --remove https://ruby.taobao.org/
https://ruby.taobao.org/ removed from sources
pengdunshiyoudeiMac:~ pdsy$ gem sources -a http://gems.ruby-china.org/
http://gems.ruby-china.org/ added to sources

9.最后升级 cocoaPods
pengdunshiyoudeiMac:~ pdsy$ sudo gem  install -n /usr/local/bin cocoa pods //这个地方不能用之前旧的更新方法:sudo gem install cocoa pods  

如果成功以后 可以 pod —version 查询一下版本 但是 我自己的电脑 出现了
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
    from /usr/local/bin/pod:22:in `<main>’
这个错误 

公司的电脑出现了

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- utils/popen (LoadError)

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'

from /usr/local/Library/Homebrew/utils.rb:6:in `<</code>top (required)>’

这个错误

我就先把 gem 版本升级了

gem update —system

然后查看 gem -v

pengdunshiyoudeiMac:local pdsy$ gem -v

2.6.8

这时候 我从网上看到一位朋友给的解决办法 我就粘贴了试了试 下面是我公司电脑出的错误 , 上面2个错误的解决办法是一样的

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 25 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/local/bin/pod:22:in `<main>

现找一下 pod的路径
pengdunshiyoudeiMac:local pdsy$ which pod
/usr/local/bin/pod

删除目录下的文件
pengdunshiyoudeiMac:local pdsy$ sudo rm -rf /usr/local/bin/pod
Password:

获取gem

pengdunshiyoudeiMac:local pdsy$ gem list

*** LOCAL GEMS ***

activesupport (5.0.0.1)
bigdecimal (default: 1.2.6)
bundler-unload (1.0.2)
cocoa (0.1.6)
concurrent-ruby (1.0.2)
executable-hooks (1.3.2)
ffi (1.9.14)
gem-wrappers (1.2.7)
i18n (0.7.0)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
pods (0.0.1)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rubygems-bundler (1.4.4)
rubygems-update (2.6.8)
rvm (1.11.3.9)
test-unit (3.0.8)
thread_safe (0.3.5)
tzinfo (1.2.2)

移除程序包

pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods -v 0.39.0
pengdunshiyoudeiMac:local pdsy$ gem uninstall cocoapods-core -v 0.39.0

在这里我没有输出 正常的会有输出
Successfully uninstalled cocoapods-0.39.0
Successfully uninstalled cocoapods-core-0.39.0

然后下面我直接安装了cocoapod
pengdunshiyoudeiMac:local pdsy$ sudo gem install cocoapods
然后下面是安装过程
………….Done installing documentation for nanaimo, colored, claide, CFPropertyList, activesupport, xcodeproj, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 15 seconds
22 gems installed
最后检查一下版本
pengdunshiyoudeiMac:local pdsy$ pod --version
1.1.1
最终完成了

最后添加几个参考地址:
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mx666666/article/details/53332263
文章标签: 苹果 ruby github
个人分类: 移动开发iOS
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭