自制软件说 Xcode 已过时

Homebrew saying Xcode is outdated

我正在尝试使用 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,我正在使用这台机器较旧的项目。

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

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

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

谢谢大家!

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

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

然后 运行 我的 brew 安装按预期工作。后来我运行:

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

切换回 Xcode 7.3.1.

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

运行 终端中的此代码

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

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

brew install jenkins

希望这能解决

重命名对我有用:

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

两个选项:

  1. 最好的选择是先更新您的 xcode,然后按照上面的

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:

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

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

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

to switch back to Xcode 7.3.1.

  1. xcode-select 设置为您的 CommandLineTools 的路径。

    sudo xcode-select --switch /Library/Developer/CommandLineTools
    

    如此处所述,.Homebrew without Xcode

两种选择都很好。

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

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

照做this

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

然后在下面的函数中删除这一行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

然后 brew install 工作正常。