【问题标题】:git error "unable to locate xcodebuild" after a fresh OS X Mavericks upgrade全新 OS X Mavericks 升级后出现 git 错误“无法找到 xcodebuild”
【发布时间】:2013-10-29 00:53:17
【问题描述】:

当我尝试运行以前工作的 git 命令时,我得到了这个:

dyld: Symbol not found: _sqlite3_intarray_bind
  Referenced from: /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
  Expected in: /opt/local/lib/libsqlite3.dylib
 in /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

我该如何解决这个问题?

【问题讨论】:

    标签: git xcodebuild osx-mavericks


    【解决方案1】:

    这对我有用sudo xcode-select --switch /Library/Developer/CommandLineTools/

    【讨论】:

    • 我有 xcode 和另一个 xcode 测试版。卸载测试版后,我收到“错误:执行失败:/usr/bin/otool -L /usr/bin/install_name_tool”。然后我做了这个突击队,它又起作用了。
    • 我做了sudo xcode-select --switch /Applications/Xcode.app 但这并没有解决我的问题。为什么你的方法能解决问题?
    • 不知道你是怎么想出来的,但它也对我有用。
    • 你必须确保安装了命令行工具,当我最终升级到 sierra 时,这些没有安装 - osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x
    • 它对我不起作用。我得到了xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools/'
    【解决方案2】:

    经过一番谷歌搜索和困惑后,以下步骤得出了一个解决方案(安装了 Xcode)。有些可能是可选的,因此请随时详细说明,因为我不是这些错误的专家。

    • 下载小牛命令行工具https://developer.apple.com/downloads/
    • xcode-select --install
    • sudo xcode-select -switch /Library/Developer/CommandLineTools
    • brew install sqlite3
    • 在我的.bashrc 文件中注释掉了DYLD_LIBRARY_PATH 条目

    【讨论】:

    • 感谢您的这些步骤。
    • 您无需下载小牛命令行工具/成为开发人员。您可以从第 2 步开始。(至少假设您有新的 xcode)
    • 在将命令行工具更新到 OSX 10.9 的 6.0 版后尝试安装 redmine 插件时出现 OP 错误。关键是运行命令sudo xcode-select -switch /Library/Developer/CommandLineTools,它修复了我的错误。谢谢!
    • 我个人只需要步骤 1-3。感谢您提供此信息!
    • 我只需要第 3 步
    【解决方案3】:

    在 MacOS Mojave 上,这对我有用(git 2.21.0):

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

    【讨论】:

    • 谢谢!也曾在 Catalina 上工作过。这是一个更好的答案,因为需要安装(第一个命令)。
    【解决方案4】:

    如果你已经安装了Xcode,可以运行以下命令确定并指向正确的位置

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

    或者使用 AppStore 安装最新的 Xcode。

    【讨论】:

    • git 在我更新到 Catalina 后停止为我工作。在 App Store 中更新 Xcode 对我有用。不需要切换任何东西。
    【解决方案5】:
    xcode-select --install
    sudo xcode-select -switch /Library/Developer/CommandLineTools
    

    这是为我做的。

    【讨论】:

      【解决方案6】:

      您很可能需要重新安装命令行工具,然后再将 xcode 路径切换为指向那里。

      首先安装工具

      $ xcode-select --install

      这会将工具安装到文件夹/Library/Developer/CommandLineTools

      然后将xcode路径指向安装工具的位置,像这样

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

      注意:您可以使用命令$ xcode-select -p 查看当前xcode 路径。当我收到错误时,我的最初指向 /Applications/Xcode.app/Contents/Developer

      【讨论】:

        【解决方案7】:

        这在 MacOS High Sierra (10.13.6) 中对我有用

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

        【讨论】:

          【解决方案8】:

          我在运行命令“git clone xxx”时遇到了这个错误

          dyld:库未加载:@rpath/libswiftCore.dylib 引用自:/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild 原因:找不到图片 git: error: 找不到xcodebuild,请确保Xcode文件夹的路径设置正确! git:错误:您可以使用 /usr/bin/xcode-select -switch 设置 Xcode 文件夹的路径

          然后,运行命令

          xcode-select -p
          

          指向/Applications/Xcode.app/Contents/Developer

          运行命令后 sudo xcode-select -switch /Library/Developer/CommandLineTools

          它指向/Library/Developer/CommandLineTools

          【讨论】:

            【解决方案9】:

            我在全新的 High Sierra 安装上运行 Fastlane 时遇到了同样的问题。 解决方法:

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

            【讨论】:

              【解决方案10】:

              也许您应该为 Mavericks 安装 Xcode 5.0.1。检查更新。

              【讨论】:

              • 问题发生在我电脑上的那个配置上
              【解决方案11】:

              这对我有用,只需粘贴到终端: sudo xcode-select --switch /Library/Developer/CommandLineTools/

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 2013-11-18
                • 1970-01-01
                • 2013-11-07
                • 2014-02-04
                • 2014-03-21
                • 1970-01-01
                • 2014-05-06
                • 2013-11-07
                相关资源
                最近更新 更多