ruby安装过程留着备用

先安装 [Xcode]

步骤1 - 安装 RVM

    $ curl -L https://get.rvm.io | bash -s stable
    $ source ~/.rvm/scripts/rvm
    $ rvm -v
    rvm 1.22.17 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

步骤2 - 用 RVM 安装 Ruby 环境

   $ rvm list known

可以选择现有的rvm版本来进行安装

   $ rvm install 2.3.0

完成以后,Ruby, Ruby Gems 就安装好了。

查询已经安装的ruby

    $ rvm list

卸载一个已安装版本 

        $ rvm remove 1.9.2

步骤3 - 设置 Ruby 版本

RVM 装好以后,需要执行下面的命令将指定版本的 Ruby 设置为系统默认版本

    $ rvm 2.0.0 --default
    $ ruby -v
    $ gem -v
    2.3.0
这有可能是因为Ruby的默认源使用的是cocoapods.org,国内访问这个网址有时候会有问题,解决方案是将远替换成淘宝的,替换方式如下:    $gem source -r https://rubygems.org/     $gem source -a https://ruby.taobao.org

    $ gem sources -l  

正常的输出结果:

      CURRENT SOURCES            

      http://ruby.taobao.org/  

出现过的问题:          

shentudeMacBook-Pro:~ shentu$ pod setup

Setting up CocoaPods master repo

这条命令后一直卡着,然后等到最后会出现个错误:

[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

然后我尝试了很多办法,首先试着手动安装CocoaPods master repo,在网上下载了master,然后$ open 命令直接放进该放的地方,可是这样你用$du -sh查看文件大小会发现他只有45M,大概是版本太旧了。

shentudeMacBook-Pro:~ shentu$ pod repo remove master

Removing spec repo `master`

shentudeMacBook-Pro:~ shentu$ pod setup

Setting up CocoaPods master repo

shentudeMacBook-Pro:~ shentu$ cd ~/.cocoapods/

shentudeMacBook-Pro:.cocoapods shentu$ du -sh

719M .

然后就特么好了···迷。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值