您的位置:首页 > 编程语言 > Ruby

Mac终端的ruby和pods安装和使用(超干货)

2016-07-28 18:09 337 查看
*********上部分是:Ruby的安装****************1.安装RVM$ curl -L https://get.rvm.io | bash -s stable2.载入rvm$ source ~/.rvm/scripts/rvm$ rvm -v3.安装Ruby$ rvm list known$ rvm install 2.0.0$ rvm list$ rvm remove 1.0.04.设置Ruby版本$ rvm 2.0.0 --default$ rvm -v$ gem -v5.看是不是设置ruby成功Ruby默认源使用的是cocoapods.org,被墙了,有一种解决方案是将源替换为淘宝的
$ gem source -r https://rubygems.org/
$ gem source -a https://ruby.taobao.org
$ gem sources -l




*********中部分是:pods的安装****************1. 安装pods
安装 CocoaPods(os x 10.11以以下)$ sudo gem install -n /usr/local/bin cocoapods
安装 CocoaPods(os x 10.11或以上)$ sudo gem install -n /usr/local/bin cocoapods
2.检查是否安装成功$ pod setup $ pod install 或 pod update即可
3.检查库内容是否存在$ pod search SDWebImage
***4.当在update或install时遇到这个问题***
Unable to find a specification for `xxxxx (~> 1.x.x)` depended upon by Podfile.
只需要把当前Pod的目录清理一下就行了。在终端执行以下命令:pod repo remove master
pod setup
setup成功后执行install或update即可。

*********下部分是:pods的使用****************1.操作的步骤1-1.cd DeskTtop/1-2.cd XX(是指项目名)1-3.vim Pofile(是编辑加入库名字)1-4.编辑按i键。输入,比如:platform :ios, '8.0'use_frameworks!
target 'App' do.......(App是指自己项目的) pod 'AFNetworking', '~> 2.6' pod 'ORStackView', '~> 3.0' pod 'SwiftyJSON', '~> 2.3'endend结束按esc键退出编辑,按:( 冒号),输入wq最后按enter键最最后:pod install或者pod update
备注:查看单前的路径:pwd 退出编辑:c d ../ 查看内容:ls
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息