ruby 运行 pod 设置给了我“错误的解释器:没有这样的文件或目录”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31442214/
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-09-06 06:45:39  来源:igfitidea点击:

running pod set up gives me "bad interpreter: No such file or directory"

rubycocoapodspodspec

提问by user3670235

recently tried to do pod setupand i get this:

最近尝试这样做pod setup,我得到了这个:

-bash: /usr/local/bin/pod: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory

I followed Ray Wenderlich's guide to install cocoapods and i get this issue so i have no idea what is going on.

我按照 Ray Wenderlich 的指南安装 cocoapods,但我遇到了这个问题,所以我不知道发生了什么。

采纳答案by user3670235

i fixed it by running brew install ruby

我通过运行修复了它 brew install ruby

回答by Torre Lasley

I encountered this problem when upgrading to Mac OS High Sierra.

我在升级到 Mac OS High Sierra 时遇到了这个问题。

This was my fix:

这是我的修复:

sudo gem install cocoapods

I found this answer on the CocoaPods issue list on Github.

在 Github的 CocoaPods 问题列表中找到了这个答案。

回答by Rendel

This happened when I upgraded to Catalina. I solved it by running:

这发生在我升级到 Catalina 时。我通过运行解决了它:

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

回答by Shan Ye

After upgraded to High Sierra, I got the same error, just reinstalled the cocoapods

升级到High Sierra后,我得到同样的错误,只是重新安装了cocoapods

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

回答by Niraj Paul

Same issue I was facing when I updated our system from Sierrato Mojave.Also works for Catalina

当我将系统从 更新SierraMojave.也适用于 Catalina时,我遇到了同样的问题

The following steps worked:

以下步骤有效:

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

I got the help from the following link.

我从以下链接获得了帮助。

回答by goodhyun

回答by Himanth

While I'm trying to install again then I got another error saying that

当我再次尝试安装时,我收到另一个错误消息

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

错误:执行 gem 时 ... (Gem::FilePermissionError) 您没有 /Library/Ruby/Gems/2.3.0 目录的写权限。

Then I did this and worked fine.

然后我做了这个并且工作正常。

sudo gem uninstall cocoapods

sudo gem install cocoapods

回答by MangoLassi

After upgrading from OS X Mojave to OS X Catalina I received this message when running pod initor pod --version: -bash: /Users/mangolassi/.gem/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

从 OS X Mojave 升级到 OS X Catalina 后,我在运行pod init或运行时收到此消息pod --version-bash: /Users/mangolassi/.gem/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

I don't like the idea of sudo gem install cocoapodsso I have my .cocoapods folder in my user directory and I've modified my .bash_profile to point to it. The error I received was because the version 2.3 was hard coded in this file: /Users/eric/.gem/bin/podand Catalina came with 2.6.

我不喜欢这样的想法,sudo gem install cocoapods所以我在我的用户目录中有我的 .cocoapods 文件夹,我已经修改了我的 .bash_profile 以指向它。我收到的错误是因为 2.3 版是硬编码在这个文件中的: /Users/eric/.gem/bin/pod而 Catalina 是 2.6 版。

It's possible that using sudo install would overwrite this file successfully, and probably does, but I wanted to keep my original setup.

使用 sudo install 可能会成功覆盖此文件,并且可能会成功,但我想保留我的原始设置。

I was able to to just modify the first shebang line of the file /Users/eric/.gem/bin/podto have a path with 2.6 instead of 2.3 and it worked. The entire change was changing the '3' to a '6' in my chase as the version was still '2'.

我能够修改文件的第一个shebang行/Users/eric/.gem/bin/pod以使用2.6而不是2.3的路径并且它起作用了。整个更改是在我的追逐中将“3”更改为“6”,因为版本仍然是“2”。

回答by SagiSergeNadir

On my mac this solved the problem:

在我的 Mac 上,这解决了问题:

brew uninstall cocoapods

brew install cocoapods

回答by cartland

Fixed with

固定与

brew upgrade cocoapods