Homebrew 说 Xcode 已过时

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

Homebrew saying Xcode is outdated

xcodecommand-linehomebrew

提问by Geoherna

I'm trying to perform an install of a package with Homebrew, but when I try to run the install I am getting the following error:

我正在尝试使用 Homebrew 执行软件包的安装,但是当我尝试运行安装时,出现以下错误:

Error: Your Xcode (7.3.1) is outdated. Please update to Xcode 8.0 (or delete it). Xcode can be updated from the App Store.

错误:您的 Xcode (7.3.1) 已过时。请更新到 Xcode 8.0(或将其删除)。Xcode 可以从 App Store 更新。

I would like to keep Xcode 7.3.1 on this machinesince I have Xcode 8 on another machine, and am using this one for older projects.

我想在这台机器上保留 Xcode 7.3.1,因为我在另一台机器上有 Xcode 8,并且正在将这个用于旧项目。

I have found a similar post on SO, but the recommended solution to set export TRAVIS=1doesn't seem to work for me. Hoping someone has a fix or a workaround I may use. Here are some more of my specifics:

我在 SO 上找到了类似的帖子,但推荐的设置解决方案export TRAVIS=1似乎对我不起作用。希望有人有我可以使用的修复或解决方法。以下是我的更多细节:

Xcode 7.3.1
Homebrew 1.0.8-135-g4284b82
macOS Sierra 10.12 (16A323)

If anything other specifics needed, please let me know.

如果需要其他任何细节,请告诉我。

Thanks guys!

谢谢你们!

回答by Geoherna

So as @NicolasMiari mentioned in a comment above, the fix to my issue ended up having to have both Xcode 7 and Xcode 8 on my machine. I went on the apple developer site, downloaded Xcode 8, saved it to my documents and then used:

因此,正如@NicolasMiari 在上面的评论中提到的那样,解决我的问题最终不得不在我的机器上同时安装 Xcode 7 和 Xcode 8。我去了苹果开发者网站,下载了 Xcode 8,将它保存到我的文档中,然后使用:

sudo xcode-select -switch ~/Documents/Xcode.app/

and then ran my brew install which worked as expected. Afterwards I ran:

然后运行我的 brew install ,它按预期工作。后来我跑了:

sudo xcode-select -switch /Applications/Xcode.app/

to switch back to Xcode 7.3.1.

切换回 Xcode 7.3.1。

Hope this helps someone else, and thanks for the suggestions.

希望这对其他人有所帮助,并感谢您的建议。

回答by jcccn

Just do as this

只是做的

Open the file /usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb,

打开文件/usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb

then delete this line check_xcode_minimum_versionin the following function.

然后check_xcode_minimum_version在以下函数中删除这一行。

def fatal_build_from_source_checks
    %w[
      check_xcode_license_approved
      check_xcode_minimum_version
      check_clt_minimum_version
      check_if_xcode_needs_clt_installed
    ].freeze
    end

Then brew installworks fine.

然后brew install工作正常。

回答by Jichao

  1. according to https://github.com/Homebrew/brew/issues/4957outdated home-brew could cause this problem, brew update-resetfix it.

  2. if step 1 does not work, reinstall homebrew with /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  1. 根据https://github.com/Homebrew/brew/issues/4957过时的 home-brew 可能会导致此问题,请brew update-reset修复它。

  2. 如果第 1 步不起作用,请重新安装自制软件 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

回答by Whitney Foster

Renaming worked for me:

重命名对我有用:

Xcode-> Xcode-old
Xcode-beta-> Xcode

Xcode-> Xcode-old
Xcode-beta->Xcode

回答by Olusola Omosola

Two options: 1. best option is to update your xcode first, then follow @George H's recommendation. " So as @NicolasMiari mentioned in a comment above, the fix to my issue ended up having to have both Xcode 7 and Xcode 8 on my machine. I went on the apple developer site, downloaded Xcode 8, saved it to my documents and then used:

两个选项: 1. 最好的选择是先更新您的 xcode,然后按照 @George H 的建议进行操作。“所以正如@NicolasMiari 在上面的评论中提到的那样,解决我的问题最终必须在我的机器上同时安装 Xcode 7 和 Xcode 8。我访问了苹果开发者网站,下载了 Xcode 8,将其保存到我的文档中,然后用过的:

sudo xcode-select -switch ~/Documents/Xcode.app/ and then ran my brew install which worked as expected. Afterwards I ran:

sudo xcode-select -switch ~/Documents/Xcode.app/ 然后运行我的 brew install ,它按预期工作。后来我跑了:

sudo xcode-select -switch /Applications/Xcode.app/ to switch back to Xcode 7.3.1."

sudo xcode-select -switch /Applications/Xcode.app/ 切换回 Xcode 7.3.1。”

  1. Set the xcode-select to the path of your CommandLineTools. sudo xcode-select --switch /Library/Developer/CommandLineTools. As explained here
  1. 将 xcode-select 设置为 CommandLineTools 的路径。sudo xcode-select --switch /Library/Developer/CommandLineTools. 正如这里所解释的

Both options work well.

这两个选项都运行良好。

回答by surendher

Run this code in terminal

在终端中运行此代码

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null

Then try running below code,

然后尝试运行下面的代码,

brew install jenkins

Hope this solves

希望这能解决