ruby安装笔记

这次下的一些ios项目 里面有用到ruby
于是开始安装 参考文档为
如何快速正确的安装 Ruby, Rails 运行环境
https://ruby-china.org/wiki/install_ruby_guide
然后在gem install bundler 的时候报错
Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/bundler-1.11.2.gemspec.rz)
发现是被墙了。
$ gem sources -r https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
* CURRENT SOURCES *

https://ruby.taobao.org

请确保只有 ruby.taobao.org
成功
$ gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 4 seconds
1 gem installed

之后就可以装其他的了。
$ sudo gem install cocoapods

此外
最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动
原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:
pod install –verbose –no-repo-update
pod update –verbose –no-repo-update

接下来还是报错。。。
NoMethodError - undefined method `to_ary’ for #

CocoaPods与ruby版本
CocoaPods : 0.39.0
Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
1
2
那么问题来了,* This is a bug with 0.39 and ruby 2.3.0 - #4689 *

解决方法:
http://blog.csdn.net/chenyblog/article/details/51143500

查询已经安装的ruby
rvm list

安装某版本的ruby

rvm install 2.0.0

卸载某版本的ruby

rvm remove 2.3.0

设置ruby版本

rvm 2.0.0 –default

猜你喜欢

转载自blog.csdn.net/lynnandwei/article/details/51147655