mark~ 10.11 cocoapods安装

执行sudo gem install cocoapods出现错误:

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/xcodeproj

自定义GEM_HOME
$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:$HOME/Sofware/ruby/bin
$ pod --version
0.39.0

执行完这句如果报告以下错误:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
ERROR: Possible alternatives: cocoapods

这是因为ruby的软件源rubygems.org因为使用亚马逊的云服务,被我天朝屏蔽了,需要更新一下ruby的源,过程如下:
$ gem sources -l (查看当前ruby的源)
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l

如果gem太老,可以尝试用如下命令升级gem
$ sudo gem update --system
升级成功后会提示: RubyGems system software updated

10.11 cocoapods安装 sudo gem install -n /usr/local/bin cocoapods



你可能感兴趣的:(cocoa,CocoaPods,10.11,pods安装)