mark~ 10.11 cocoapods安裝

執行sudo gem install cocoapods出現錯誤:xcode

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.0ruby

執行完這句若是報告如下錯誤:
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: cocoapodsspa

這是由於ruby的軟件源rubygems.org由於使用亞馬遜的雲服務,被我天朝屏蔽了,須要更新一下ruby的源,過程以下:
$ gem sources -l (查看當前ruby的源)
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -lcode

若是gem太老,能夠嘗試用以下命令升級gem
$ sudo gem update --system
升級成功後會提示: RubyGems system software updatedorm

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

相關文章
相關標籤/搜索