ios安裝cocoaPods

1. 安裝
a. 查看源 html

i.   gem sources -lxcode

b. 刪除源ruby

i.   sudo gem sources -r https://rubygems.org/ide

c. 設置源 post

   i.    sudo gem sources -a https://ruby.taobao.org --- 這裏要換成新的源!!!fetch

        添加國內最新的源 ruby-chinaui

     sudo gem sources -a https://gems.ruby-china.orgspa

 

 

d. 安裝cocoaPad.net

 -->    sudo gem install cocoapods -->code

 or ->升級gem sudo gem update --system 也是正常的

 or ->安裝CocoaPods執行正常:sudo gem install -n /usr/local/bin cocoapods

 

e. 設置 

i. pod setup

 

2. cocoaPods使用

a. 搜索 <可略過>
i. pod search SDWebImage

b. 切換到項目的根目錄 <可略過>
i. echo "pod' SDWebImage'" >Podfile

c. 安裝
i. pod install

d. 升級
i. pod update 

 
 升級了<優勝美地10.11系統>後出現:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.
rb:245: in  'mkdir' : Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal
-darwin-14 (Errno::EACCES)
 
使用下面的方法來解決:

 

1. 分別執行下面命令卸載cocoapods和xcodeproj,若是你的機器上面有多個版本,選擇All versions卸載 

 
 
 
$ sudo gem uninstall cocoapods
 
$ sudo gem uninstall xcodeproj

2. 分別執行下面命令安裝xcodeproj和cocoapods 

 
 
 
$ sudo gem install xcodeproj
 
$ sudo gem install cocoapods

接下來嘗試執行pod install,若是您還遇到下面的錯誤:

1
2
Error loading the plugin  with  path  '/Library/Ruby/Gems/2.0.0/gems/cocoapods-plugins-0.3.1/lib/cocoapods_plugin.rb' .
Errno::EACCES - Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14

運行命令$ gem update --system便可。

 

查看當前安裝了哪些版本:

gem list --local | grep cocoapods

 

解決 cocoapods安裝路徑問題:

解決方法:在路徑裏面手動添加/usr/local/bin

若是不行就在終端執行更改命令:

sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin cocoapods
sudo chmod +rx /usr/local/bin/

// -------------------------------------------  

ERROR:  While executing gem ... (Errno::EPERM)

    Operation not permitted - /usr/bin/xcodeproj

報上邊這錯誤 執行下面的代碼: 

 sudo gem install -n /usr/local/bin cocoapods

SuperdeMacBook-Pro:.cocoapods super$ sudo gem install cocoapods

SuperdeMacBook-Pro:.cocoapods super$ sudo gem install -n /usr/local/bin cocoapods

Successfully installed xcodeproj-1.1.0

Fetching: cocoapods-1.0.1.gem (100%)

Successfully installed cocoapods-1.0.1

Parsing documentation for xcodeproj-1.1.0

Installing ri documentation for xcodeproj-1.1.0

Parsing documentation for cocoapods-1.0.1

Installing ri documentation for cocoapods-1.0.1

2 gems installed

SuperdeMacBook-Pro:.cocoapods super$ 

 

 

 

 

【連接】cocoapods的安裝遇到Errorinstallingpods:activesupport
http://www.cnblogs.com/gongyuhonglou/p/5801681.html

//-----------------------------------------------遇到的另一個報錯

ERROR: While executing gem ... (Gem::DependencyError) Unable to resolve dependencies: cocoapods requires claide (< 2.0, >= 1.0.1), cocoapods-downloader (< 2.0, >= 1.1.2), cocoapods-trunk (< 2.0, >= 1.1.1), molinillo (~> 0.5.3), xcodeproj (< 2.0, >= 1.4.0), fourflusher (~> 2.0.1)

解決的連接:http://blog.csdn.net/miao_em/article/details/53282730 

解決的命令:sudo gem update --system

 

// ----------------------------------------------遇到的另一個報錯

添加國內ruby源 gem sources --add https://gems.ruby-china.org

報錯:

Error fetching https://gems.ruby-china.org/:

bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

緣由是 ruby-china 更換了域名

https://gems.ruby-china.com

命令替換爲 gem sources --add https://gems.ruby-china.com 解決

相關文章
相關標籤/搜索