美文网首页iOS 开发ios学习资料iOS开发环境搭建相关
命令行执行命令时报错You don't have wri

命令行执行命令时报错You don't have wri

作者: 春暖花已开 | 来源:发表于2017-05-27 16:19 被阅读3283次

    这是因为要执行这些操作时必须有管理员的权限(比如更新软件),比如更新cocoapods时报错:

    MyPro:~ MyPro$ gem install cocoapods
    ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

    解决方法:只需要在命令前加上sudo,例如:sudo gem install cocoapods即可。sudo是获取管理员权限,现在按照步骤输入管理员密码即可。

    但,接着又报错:

    MyPro:~ MyPro$ sudo gem install cocoapods
    Password:
    ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod

    解决办法:

    sudo gem install -n /usr/local/bin cocoapods````
    
    ###治标不治本,下一次还会再出现,永久解决办法:
    命令行工具网址:[http://brew.sh](http://brew.sh/)
    运行命令行:
    

    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    $ brew install ruby````

    相关文章

      网友评论

      本文标题:命令行执行命令时报错You don't have wri

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