$ which podhtml
/Users/galahad/.rvm/gems/ruby-2.2.2/bin/pod sublime-text
/usr/local/bin/podapi
Q: RubyGems是什么?缓存
A: RubyGems(简称 gems)是一个用于对 Ruby组件进行打包的系统。 它提供一个分发 Ruby 程序和库的标准格式,还提供一个管理程序包安装的工具。ruby
发现Cocoapods的程序包bash
cocoapods (1.1.1)app
cocoapods-core (1.1.1)curl
cocoapods-deintegrate (1.0.1)工具
cocoapods-downloader (1.1.2)测试
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.1.1)
cocoapods-try (1.1.0)
3、ruby版本是否合适?干脆重装
使用RVM也就是Ruby Version Manager,Ruby版本管理器来升级ruby,RVM包含了Ruby的版本管理和Gem库管理(gemset)。
RVM安装
一、RVM安装
$ curl -L get.rvm.io | bash -s stable
二、以后就是等待一段时间以后,就能够安装成功了,使用如下命令来验证
$ source ~/.bashrc
$ source ~/.bash_profile
三、测试是否安装正常
$ rvm -v
出现rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]就算成功了。
使用RVM升级Ruby
一、查看当前ruby版本
$ ruby -v
这一步会显示出来当前ruby的版本
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
二、列出已知ruby的版本
$ rvm list known
个人电脑上面会出现下面这些信息:
Warning, new version of rvm available '1.28.0', you are using older version '1.27.0'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
.......
我么先按照提示进行升级。
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.6]
[ruby-]2.3[.3]
[ruby-]2.4[.0-rc1]
ruby-head
其中Ruby 2.4.0 rc1 表示 2.4 首个候选版
咱们能够安装2.3.3版本
三、安装ruby 2.3.3
$ rvm install 2.3.3
若是安装以下所示的话,表示已经安装过
$ rvm install 2.3.3
Already installed ruby-2.3.3.
To reinstall use:
rvm reinstall ruby-2.3.3
若是想从新安装的话:rvm reinstall ruby-2.3.3
正常状况下面:
Checking requirements for osx.
Updating Homebrew...
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
之前安装的过程当中遇到的问题以及解决方法:
一、homeBrew版本太低
解决方法:sudo chown -R $(whoami):admin /usr/local
输入密码后从新执行brew update
,最后提示Already up-to-date
的时候,brew自己就更新好了(这个过程比较久).
接着用brew outdated
命令查看brew下哪些软件能够进行升级.
而后brew upgrade
命令用来升级因此能够升级的软件.
最后记得用brew cleanup
来清理不须要的版本及其安装包缓存.
截止目前,brew也被咱们更新好了.
二、注意事项:安装CocoaPots的顺序:
Libraries missing for ruby-2.3.3: /Users/travis/.rvm/rubies/ruby-2.3.3/lib/libruby.2.3.0.dylib,/usr/local/opt/gdbm/lib/libgdbm.4.dylib. Refer to your system manual for installing libraries
四、我在安装ruby-2.3.3的时候发现还有一个错误
Error running '__rvm_patch -F 25 -p1 -N -f -i /Users/galahad/.rvm/patches/ruby/2.3.3/openssl3.patch',
showing last 15 lines of /Users/galahad/.rvm/log/1484210020_ruby-2.3.3/patch.apply.openssl3.log
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/galahad/.rvm/log/1484210020_ruby-2.3.3/make.log
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
Referenced from: /Users/galahad/.rvm/src/ruby-2.3.3/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _clock_gettime
Referenced from: /Users/galahad/.rvm/src/ruby-2.3.3/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
make: *** [.rbconfig.time] Trace/BPT trap: 5
++ return 2
There has been an error while running make. Halting the installation.
安装2.3.3版本的时候,老是报这个错误,才意识到本身的电脑系统仍是10.11.6。更新mac系统到最新版本便可。
五、安装2.3.3成功后,路径不对
$ pod install
/Library/Ruby/Site/2.0.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:298:in `activate_bin_path'
from /usr/local/bin/pod:22:in `<main>'
问题再现描述:关闭终端,再进来就恢复原来的版本了,解决方式对应下面的“ruby安装成功后,路径适配”
问题再现描述:关闭终端,再从新启动就出现上面的问题,解决方式:解决路径的适配问题的同时参考上面“移除 RubyGems 中的 Cocoapods程序包”进行解决。
ruby安装成功后,路径适配
须要执行命令:
$ rvm use system
设置回系统默认版本:
$ rvm 2.3.3--default
设置某个版本为默认(前提是这个版本已经安装,若是没有安装的话:rvm install ruby-2.3.3-default 便可)
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
gem install cocoapods --pre (最新版本,若是最新版不稳定的话,建议不要执行,由于获得的也包括测试版)
也能够指定安装版本:
$ sudo gem install cocoapods -v 1.1.1
$ sudo gem install -n /usr/local/bin cocoapods
也能够参考参考:http://www.cnblogs.com/richard-youth/p/4508049.html