美文网首页iOS开发小抄
cocoapods 安装失败解决方法-场景1

cocoapods 安装失败解决方法-场景1

作者: zhangyin | 来源:发表于2017-03-09 14:35 被阅读5次

    为这个世界继续灌水………………
    ...................

    cocoapods的官网地址:https://cocoapods.org

    WHAT IS COCOAPODS

    • CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
    • It has over 29 thousand libraries and is used in over 1.8 million apps.
    • CocoaPods can help you scale your projects elegantly.

    错误描述

    使用以下命令安装cocoapods
    $ sudo gem install cocoapods
    
    提示:
    ERROR:  While executing gem ... (Errno::EPERM)
    
    Operation not permitted - /usr/bin/xcodeproj
    或者:
    Operation not permitted -/usr/bin/pods
    .....
    等等  not permitted 之类的错误..
    

    这可能是因为之前的安装过程出现问题导致遗留下来错误的状态导致。

    清理方法

    最简单粗暴的办法是,清除在历史安装过程中的所有残留文件,然后重新安装;

    使用以下命令查看残留文件:

    $ gem list | grep cocoapods
    返回:
    cocoapods-core (1.2.0)
    cocoapods-deintegrate (1.0.1)
    cocoapods-downloader (1.1.3)
    cocoapods-plugins (1.0.0)
    cocoapods-search (1.0.0)
    cocoapods-stats (1.0.0)
    cocoapods-trunk (1.1.2)
    cocoapods-try (1.1.0)
    
    

    然后卸载所有的残留文件:

    示例:
    $ sudo gem uninstall cocoapods-core
    Password:
    Successfully uninstalled cocoapods-core-1.2.0
    
    

    全部清理完毕,即可以重新安装了;

    localhost:~ mac$ sudo gem install -n /usr/local/bin  cocoapods 
    

    查看cocoapods的版本号:

    localhost:~ mac$ pod --version
    

    相关文章

      网友评论

        本文标题:cocoapods 安装失败解决方法-场景1

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