标签:
$gem sources --remove https://rubygems.org/
$gem sources -a https://ruby.taobao.org/
$gem sources -l
$sudo gem install cocoa pods
//–––––––––––那么问题来了——没遇到的自动跳过————————————
Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
1、安装 RVM baby 版本管理器
$curl -L get.rvm.io | bash -s stable
//________等安装完成 出现下面这行提示以下___________
In case of problems: https://rvm.io/helpandhttps://twitter.com/rvm_io
执行
$source ~/.bashrc
$source ~/.bash_profile
测试是否安装正常
$rvm -v
//________提示以下___________
rvm 1.27.0 (latest) by Wayne E. Seguin, Michal Papis[https://rvm.io/]
2、用RVM升级Ruby查看当前ruby版本
$ruby -v
$rvm list known
//________提示以下___________
# MRI Rubies
[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[.8]
[ruby-]2.2[.4]
[ruby-]2.3[.0]
[ruby-]2.2-headruby-head
# for forks use: rvm install ruby-head---url https://github.com/github/ruby.git --branch 2.2
# JRuby
安装ruby 2.2.2 执行
$rvm install 2.2.2
如果打印:
…… ruby-2.2.2 - #validate archive ruby-2.2.2 - #extract ruby-2.2.2 - #validate binary ruby-2.2.2 - #setup ruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2@global ruby-2.2.2 - #importing gemset
/Users/abc/.rvm/gemsets/global.gems.............................. ruby-2.2.2 - #generating global wrappers........ ruby-2.2.2 - #gemset created /Users/abc/.rvm/gems/ruby-2.2.2 ruby-2.2.2 - #importing gemsetfile /Users/abc/.rvm/gemsets/default.gems
evaluated to empty gem list ruby-2.2.2 - #generating default wrappers........ Updating certificates in ‘/etc/openssl/cert.pem‘. mkdir: /etc/openssl: Permission denied mkdir -p "/etc/openssl" failed, retrying with sudo LiuWenqiang password required for ‘mkdir -p /etc/openssl‘: and sudo mkdir worked则说明安装成功了
打印代码:
Done with Command Line Tools (OS X 10.11) for Xcode Done. ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> Installing the Command Line Tools (expect a GUI popup): ==> /usr/bin/sudo /usr/bin/xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates Failed during: /usr/bin/sudo /usr/bin/xcode-select --install Requirements installation failed with status: 1.
4. 继续安装 CocoaPods
$sudo gem install cocoa pods
$sudo gem install -n /usr/local/bin cocoapods
$pod setup
5. 更新 gem
$sudo gem update --system
6. 新建一个项目,名字PodTest
7. $ cd 项目路径 (中间有空格,)
cd /Users/lucky/Desktop/PodTest
8. 建立Podfile(配置文件)
$vim Podfile
键盘输入 i 进入编辑模式,输入
platform :ios, ‘7.0‘
pod ‘MBProgressHUD‘, ‘~> 0.8’ (之前的,我的电脑上已经无效了,报错: [!] The dependency `MBProgressHUD (~> 0.8)` is not used in any concrete target.)
(现在使用:MyApp 替换成自己的项目名)
target ‘MyApp‘ do
pod ‘AFNetworking‘, ‘~> 2.6‘
pod ‘ORStackView‘, ‘~> 3.0‘
end
然后按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq
再输入 $pod install
注意:现在打开项目不是点击 PodTest.xodeproj了,而是点击 PodTest.xcworkspace
为了确定AFNetworking是否支持CocoaPods,可以用CocoaPods的搜索功能验证一下。在终端中输入:
$ pod search AFNetworking
如果安装失败
Check XCode is installed or not.
$gcc --version
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$brew doctor
$brew update.
完成后 执行
$ruby -v
//–––––打印输出–––––––
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
$sudo gem install cocoa pods
//______安装成功提示如下______
Done installing documentation for nap, fourflusher, escape, colored, concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, claide, xcodeproj, molinillo, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 21 seconds,23 gems installed
$pod setup
备注:苹果系统升级 OS X EL Capitan 后安装改为:
$sudo gem install -n /usr/local/bin cocoapods
$pod setup
对于初次使用CocoaPods的同学,即使你不使用pod setup命令,在你初次执行pod install命令时,系统也会自动执行pod setup。而由于网络不稳定的原因,不挂VPN是不可能成功执行pod setup的。(我大天朝的墙啊~~~~)
$ pod repo remove master
$ git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master
$ pod repo update
$sudo gem update --system
$pod search 第三方
$ touch Podfile
platform:ios, ‘8.0‘
#use_frameworks!个别需要用到它,比如reactiveCocoa
target ‘XXXApp‘ do
pod ‘AFNetworking‘, ‘~> 2.3.1‘<-------第三方
end
$pod install --no-repo-update
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Failed during: /usr/bin/sudo /usr/bin/xcode-select --install
Requirements installation failed with status: 1.
此时查询Xcode,切换到另一个环境:
$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password:
$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
ERROR: Error installing cocoapods:
activesupport requires Ruby version >= 2.2.2.
localhost:~ zzz$ $curl -L get.rvm.io | bash -s stable
-bash: -L: command not found
localhost:~ zzz$
解决方法:
ruby -e "$(wget -qO - ‘https://raw.github.com/mxcl/homebrew/go‘)"
$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password: (输入电脑权限密码)
$ git
usage: git [--version] [--help] [-C <path>] [-c name=value] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>]
cocoapods的安装 遇到 Error installing pods:activesupport requires Ruby version >=2.2.2
标签:
原文地址:http://www.cnblogs.com/gongyuhonglou/p/5801681.html