【问题标题】:troubles when I use homebrew我使用自制软件时遇到的麻烦
【发布时间】:2015-08-27 04:09:59
【问题描述】:

我想在我的 Mac(OS X 10.10.3) 上安装 git。我写:brew install git

但它报告了:

sh: line 1:  1549 Abort trap: 6           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
sh: line 1:  1552 Abort trap: 6           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find otool 2> /dev/null
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool

然后我写 brew doctor。它报告:

Warning: /usr/local/include isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/include

Warning: /usr/local/lib isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib
sh: line 1:  1318 Abort trap: 6           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find otool 2> /dev/null
otool: error: unable to find utility "otool", not a developer tool or in PATH
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool

然后我 chown 库并包含“sudo chown 755 include”“sudo chown 755 lib” 第一个和第二个警告被删除,但第三​​个仍然存在。

更让我困惑的是,在我的 finder:/usr/local/ 中,“include”和“lib”应该是文件夹,但变成了文件。 如何解决“找不到 otool”错误并使用 brew 和

安装 git

为什么我的 lib 和 include 文件夹变成了文件?...感谢您的帮助!

【问题讨论】:

  • 这应该是问题跟踪器上的错误报告。
  • 你的 Xcode 环境坏了。如果 /usr/bin/clang 丢失,你应该重新安装 OS X。如果它存在,你应该确保 xcode-select -p 指向开发者路径。否则,您应该重新安装 Xcode 或 Xcode 命令行工具。
  • @TimSmith 感谢您的帮助。在 /usr/bin/clang 中仍然存在。 'xcode-select -p' 指向 /Applications/Xcode.app/Contents/Developer。我不明白为什么我的两个文件夹变成了文件。这令人困惑。因为我在我的 xcode 中运行程序没有问题。有人建议重新安装自制软件。我不知道该怎么办?你能解释一下吗?
  • @NickVolynkin 抱歉,我是 Mac 新手。对我应该怎么做有什么建议吗?
  • @Shawn 我指的是 GitHub 上的 Homebrew 问题跟踪器。但由于 Tim Smith 是 Homebrew 维护者,因此没有必要这样做。

标签: git include homebrew


【解决方案1】:

问题是Xcode由于某种原因无法找到自己的命令行工具:

sh: line 1:  1549 Abort trap: 6      /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH

在您的终端中查看xcode-select --print-path

如果是/Applications/Xcode.app/Contents/Developer,则运行sudo xcode-select --switch /Library/Developer/CommandLineTools 将xcode-select 设置为非Xcode 命令行工具。

如果您没有/Library/Developer/CommandLineTools 目录,您可以在https://developer.apple.com/downloads/ 获取当前 Xcode 版本的目录。

【讨论】:

  • 也许你是对的。但是我只是重新安装了我的操作系统,因为即使重新安装 Xcode 也无法解决问题。
  • @Shawn 我也尝试过重新安装 Xcode,但没有帮助。但是更改 xcode-select 路径解决了所有问题。
  • 这是否意味着如果我从下载中心安装 CLT,而不从 Xcode 自动安装,我总是需要手动进行此更改?
  • @jayatubi 对于 Xcode 6 来说似乎是这样,但我还没有测试过 Xcode 7。
  • 工作就像一个魅力!。 TY
【解决方案2】:

首先。也许您应该在安装之前更新自制软件:

brew update

第二。也许这条指令有帮助(取自Ask Different)。至少在您解决问题时很有用:

      brew install git
      $ git --version
           git version 1.7.12.4 (Apple Git-37)
      $ which git
           /usr/bin/git
      **// doh! osx's pre-installed git trumps the brew one, so:**
      $ sudo mv /usr/bin/git /usr/bin/git-apple
      $ which git
           /usr/local/bin/git
      $ git --version
           git version 1.8.2
      // ok cool.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-02
    • 2013-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-26
    • 1970-01-01
    相关资源
    最近更新 更多