美文网首页
解决Mac OS X 10.11更新以后Cococapods找不

解决Mac OS X 10.11更新以后Cococapods找不

作者: Andy__M | 来源:发表于2016-07-07 15:09 被阅读141次

    注:本文内容转载http://www.th7.cn/system/mac/201511/142132.shtml ,并整理

    问题

    在开发时,忽然发现自己的Cococapods不能用了,百度后才知道是升级为10.11的系统以后执行pod install时报错导致的,为便于以后翻阅,在此记录下问题修复的方法~~

    : command not found: pod
    

    解决方法如下:

    1.检查gem 的数据源

    baidudeMacBook-Air:~ Andy__M$ gem sources -l
    *** CURRENT SOURCES ***
    
    http://ruby.taobao.org/
    

    可能是跟iOS9一样,Capitan 10.11禁止了http的请求了,改成https的协议头就好了

    baidudeMacBook-Air:~ Andy__M$ gem sources --remove         
    http://ruby.taobao.org/
    http://ruby.taobao.org/ removed from sources
    baidudeMacBook-Air:~ Andy__M$ gem sources -a     
    https://ruby.taobao.org/
    https://ruby.taobao.org/ added to sources
    

    2.重新安装pod

    baidudeMacBook-Air:~ Andy__M$ sudo gem install cocoapods
    Fetching: nap-1.1.0.gem (100%)
    Successfully installed nap-1.1.0
    Fetching: cocoapods-core-1.0.1.gem (100%)
    Successfully installed cocoapods-core-1.0.1
    Fetching: claide-1.0.0.gem (100%)
    Successfully installed claide-1.0.0
    Fetching: cocoapods-deintegrate-1.0.0.gem (100%)
    Successfully installed cocoapods-deintegrate-1.0.0
    Fetching: cocoapods-downloader-1.0.1.gem (100%)
    Successfully installed cocoapods-downloader-1.0.1
    Fetching: cocoapods-plugins-1.0.0.gem (100%)
    Successfully installed cocoapods-plugins-1.0.0
    Fetching: cocoapods-search-1.0.0.gem (100%)
    Successfully installed cocoapods-search-1.0.0
    Fetching: cocoapods-stats-1.0.0.gem (100%)
    Successfully installed cocoapods-stats-1.0.0
    Fetching: cocoapods-trunk-1.0.0.gem (100%)
    Successfully installed cocoapods-trunk-1.0.0
    Fetching: cocoapods-try-1.0.0.gem (100%)
    Successfully installed cocoapods-try-1.0.0
    Fetching: molinillo-0.4.5.gem (100%)
    Successfully installed molinillo-0.4.5
    Fetching: xcodeproj-1.1.0.gem (100%)
    Successfully installed xcodeproj-1.1.0
    Fetching: fourflusher-0.3.2.gem (100%)
    Successfully installed fourflusher-0.3.2
    Fetching: cocoapods-1.0.1.gem (100%)
    Successfully installed cocoapods-1.0.1
    Fetching: concurrent-ruby-1.0.2.gem (100%)
    Successfully installed concurrent-ruby-1.0.2
    Parsing documentation for nap-1.1.0
    Installing ri documentation for nap-1.1.0
    Parsing documentation for cocoapods-core-1.0.1
    Installing ri documentation for cocoapods-core-1.0.1
    Parsing documentation for claide-1.0.0
    Installing ri documentation for claide-1.0.0
    Parsing documentation for cocoapods-deintegrate-1.0.0
    Installing ri documentation for cocoapods-deintegrate-1.0.0
    Parsing documentation for cocoapods-downloader-1.0.1
    Installing ri documentation for cocoapods-downloader-1.0.1
    Parsing documentation for cocoapods-plugins-1.0.0
    Installing ri documentation for cocoapods-plugins-1.0.0
    Parsing documentation for cocoapods-search-1.0.0
    Installing ri documentation for cocoapods-search-1.0.0
    Parsing documentation for cocoapods-stats-1.0.0
    Installing ri documentation for cocoapods-stats-1.0.0
    Parsing documentation for cocoapods-trunk-1.0.0
    Installing ri documentation for cocoapods-trunk-1.0.0
    Parsing documentation for cocoapods-try-1.0.0
    Installing ri documentation for cocoapods-try-1.0.0
    Parsing documentation for molinillo-0.4.5
    Installing ri documentation for molinillo-0.4.5
    Parsing documentation for xcodeproj-1.1.0
    Installing ri documentation for xcodeproj-1.1.0
    Parsing documentation for fourflusher-0.3.2
    Installing ri documentation for fourflusher-0.3.2
    Parsing documentation for cocoapods-1.0.1
    Installing ri documentation for cocoapods-1.0.1
    Parsing documentation for concurrent-ruby-1.0.2
    Installing ri documentation for concurrent-ruby-1.0.2
    15 gems installed
    baidudeMacBook-Air:~ Andy__M$ 
    

    如果再次报错了

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

    3.使用指令,安装成功

    baidudeMacBook-Air:~ Andy__M$ sudo gem install -n /usr/local/bin cocoapods
    Password:
    Successfully installed cocoapods-1.0.1
    Parsing documentation for cocoapods-1.0.1
    1 gem installed
    

    如果成功了,可以试一下~~

    baidudeMacBook-Air:~ Andy__M$ cd /Users/baidu/Downloads/SWTableViewCell-master 
    baidudeMacBook-Air:SWTableViewCell-master Andy__M$ pod install
    Analyzing dependencies
    Downloading dependencies
    Installing Expecta (1.0.5)
    

    4.没有安装成功?

    如果上面的操作完以后还是如下报错的话:

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

    那么你就需要按照下面的操作方法进行操作了:

    mkdir -p $HOME/Software/ruby
    export GEM_HOME=$HOME/Software/ruby
    gem install cocoa pods
    export PATH=$PATH:$HOME/Software/ruby/bin
    

    然后执行:

    sudo gem update --system
    

    install命令执行成功后,执行:

    pod setup
    

    执行成功显示:

    Setting up CocoaPods master repo
    

    .........

    Setup completed

    注意:执行第一句的时候会等待比较久的时间,这步其实是cocapods下载信息到~/.cocoapods 目录下。查看下载进度命令:

    cd ~/.cocoapods
    du -sh*
    

    然后你可以试下:

    pod search AFNetworking
    

    相关文章

      网友评论

          本文标题:解决Mac OS X 10.11更新以后Cococapods找不

          本文链接:https://www.haomeiwen.com/subject/mcdljttx.html