在 ./symbolicatecrash 第 115 行的 macosx SDK 或任何后备 SDK 中找不到名为 'otool' 的工具

can't find tool named 'otool' in the macosx SDK or any fallback SDKs at ./symbolicatecrash line 115

我尝试使用 symbolicatecrash ~~~.crash 和 dSYM 文件分析 Apple 商店提供的崩溃 iOS 应用程序崩溃日志。 但是,当我尝试制作 crash.log 时,出现以下错误。你能告诉我如何解决这个问题吗?

$ ./symbolicatecrash ~~~.crash ~~~.dSYM > crash.log

sh: ”/Applications/Xcode.app/Contents/Developer”/usr/bin/xcrun: No such file or directory
Error: can't find tool named 'otool' in the macosx SDK or any fallback SDKs at ./symbolicatecrash line 115.

以下是symbolicatecrash文件

#symbolicatecrash
sub getToolPath {
    my ($toolName, $sdkGuess) = @_;

    if (!defined($sdkGuess)) {
        $sdkGuess = "macosx";
    }

    my $toolPath = `'$DEVELOPER_DIR/usr/bin/xcrun' -sdk $sdkGuess -find $toolName`;
    if (!defined($toolPath) || $? != 0) {
        if ($sdkGuess eq "macosx") {
            die "Error: can't find tool named '$toolName' in the $sdkGuess SDK or any fallback SDKs"; <------ This line is line115
        } elsif ($sdkGuess eq "iphoneos") {
            print STDERR "## Warning: can't find tool named '$toolName' in iOS SDK, falling back to searching the Mac OS X SDK\n";
            return getToolPath($toolName, "macosx");
        } else {
            print STDERR "## Warning: can't find tool named '$toolName' in the $sdkGuess SDK, falling back to searching the iOS SDK\n";
            return getToolPath($toolName, "iphoneos");
        }
    }

    chomp $toolPath;
    print STDERR "$toolName path is '$toolPath'\n" if $opt{v};

    return $toolPath;
}

1)

在命令行输入:

xcode-select --print-path

如果它显示 /Application/Xcode.app/Contents/Developer 的路径,则转到步骤 2。如果没有,请使用“sudo xcode-select -s /path/to/your/Xcode/Contents/Developer”文件夹更改路径。

2)

尝试安装 Xcode 命令行工具,您可以在 http://developer.apple.com/xcode 站点的 "Additional Tools" link 下找到它。

3)

确保你的 .tcshrc / .bashrc "$PATH" 环境变量是正确的。在我的本地机器上,“xcrun”位于“/usr/bin”,otool 也位于“/usr/bin”。

我用bash尝试过同样的操作(在我使用zsh之前),然后很顺利。看来问题出在.zshrc的设置上。

将 DEVELOPER_DIR 设置为“”有效 $ export DEVELOPER_DIR=””