ios Cocoa Pods 不更新 El Capitan 上的 Pod

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33077977/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 07:58:02  来源:igfitidea点击:

Cocoa Pods not updating pods on El Capitan

ioscocoapodsosx-elcapitan

提问by Luda

I've upgraded to El Capitan and since then I can't update my pods.

我已升级到 El Capitan,从那时起我无法更新我的 Pod。

$ pod update
-bash: pod: command not found

So I've tried to reinstall CocoaPods and got this:

所以我尝试重新安装 CocoaPods 并得到这个:

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

I am the administrator on this computer. Why is this happening?

我是这台电脑的管理员。为什么会这样?

回答by Keith Smiley

This is caused by the new System integrity protectionfeature introduced in El Capitan. It restricts even administrators from writing to /usr/bin.

这是由El Capitan 中引入的新系统完整性保护功能引起的。它甚至限制管理员写入/usr/bin.

Your best option would be to install gems without needing sudo. There is a good guide on how to do that:

您最好的选择是在不需要sudo. 关于如何做到这一点,有一个很好的指南

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

gem install cocoapods

回答by Warif Akhand Rishi

From CocoaPods issues 3736

来自CocoaPods 问题 3736

  1. Uninstall all instances of cocopods (just to be safe and keep things clean) see fully uninstall Cocoapods

    sudo gem uninstall cocoapods
    

    or even better fully uninstall all components (and select All versions for each)

    gem list --local | grep cocoapods | awk '{print }' | xargs sudo gem uninstall
    
  2. Install again

    sudo gem install -n /usr/local/bin cocoapods
    
  3. Change access permission

    sudo chmod +rx /usr/local/bin/
    
  1. 卸载所有 cocopods 实例(只是为了安全并保持干净)请参阅完全卸载 Cocoapods

    sudo gem uninstall cocoapods
    

    甚至更好地完全卸载所有组件(并为每个组件选择所有版本)

    gem list --local | grep cocoapods | awk '{print }' | xargs sudo gem uninstall
    
  2. 重新安装

    sudo gem install -n /usr/local/bin cocoapods
    
  3. 更改访问权限

    sudo chmod +rx /usr/local/bin/
    

回答by Inder Kumar Rathore

This should work for you

这应该适合你

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

Operation not permitted - /usr/bin/xcodeproj #3692

不允许的操作 - /usr/bin/xcodeproj #3692

For whatever reason, the rootless stuff seems less restrictive when one simply upgrades the system. I could sudo gem install cocoapods just fine on a machine upgraded from 10.10 - however, binstubs are no longer installed into /usr/bin:

无论出于何种原因,当一个人简单地升级系统时,无根的东西似乎没有那么严格。我可以在从 10.10 升级的机器上 sudo gem install cocoapods 就好了 - 但是,binstubs 不再安装到 /usr/bin 中:

$ sudo gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:/Library/Ruby/bin
$ pod --version
0.37.2

We have heard from some users that they receive this error when doing a system-wide installation:

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

We aren't sure why gem behaves differently on some systems, but this can be solved by passing -n /usr/local/binto the install command, so that the pod executable gets installed there.

我们从一些用户那里听说他们在进行系统范围的安装时收到此错误:

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

我们不确定为什么 gem 在某些系统上的行为不同,但这可以通过传递-n /usr/local/bin给 install 命令来解决,以便 pod 可执行文件安装在那里。

回答by stonecanyon

Regarding the original question/problem:

关于原始问题/问题:

$ sudo gem install cocoapods
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted

I found I had the same problem with severalGEMS, so I generalized the recognized answer (Keith Smiley) to update ALL local gems... (on El Capitan with rootless in force)

我发现我在几个GEMS 上遇到了同样的问题,所以我概括了公认的答案 ( Keith Smiley) 来更新所有本地宝石......(在 El Capitan 上使用 rootless 生效)

$ sudo gem install cocoapods -n /usr/local/bin/    # this command installs
$ sudo gem update -n /usr/local/bin/    # this command updates all local gems 

This works well and will spit out a verbose log of all updates and errors.

这很有效,并且会输出所有更新和错误的详细日志。

I saw manyerrors. They were all 'unable to convert' errors. Parsing many docs will encounter a "skipping" error... like this:

我看到了很多错误。他们都是“无法转换”错误。解析很多文档会遇到“跳过”错误……像这样:

$ unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/jazzy... skipping

I believe these skipping errors are not problems.

我相信这些跳过错误不是问题。

CocoaPods will be updated during this process, along with all the other local GEMS, depending on how current your local GEMS are. I believe this is the best way to handle the rootless issue (which is the cause of the problem).

CocoaPods 将在此过程中与所有其他本地 GEMS 一起更新,具体取决于您本地 GEMS 的最新情况。我相信这是处理无根问题(这是问题的原因)的最佳方法。

回答by Gopal Raju

Your best option for installing Pods for custom and standard installation Refer the Link :https://github.com/CocoaPods/CocoaPods/issues/3692

为自定义和标准安装安装 Pod 的最佳选择请参阅链接:https: //github.com/CocoaPods/CocoaPods/issues/3692

enter image description here

在此处输入图片说明

回答by telip007

Did you install Xcode Command Line tools again ? That solved my problem. You need to select Command Line tool in Xcode preferences(Locations) and than install cocoa pods.

您是否再次安装了 Xcode 命令行工具?那解决了我的问题。您需要在 Xcode 首选项(位置)中选择命令行工具,然后安装可可豆荚。

回答by GKK

For me it worked with: sudo gem install -n /usr/local/bin cocoapods --pre

对我来说,它适用于: sudo gem install -n /usr/local/bin cocoapods --pre