我在 OClint 与 xcode 集成期间遇到了这个问题。 所以从 OS X 10.2 开始,它有 bash 作为默认 shell,所以每当你安装某些东西并设置 PATH 变量时,它都会在 bash shell 中设置。 现在在任何目标的 xcode 中,如果您尝试在构建阶段(在build设置中)添加运行脚本,那么它会尝试在 sh shell 中运行,因此即使您在构建阶段设置中将 shell 路径更改为/bin/bash 它始终运行因为那里的/bin/sh 和 PATH 变量没有设置,所以它找不到已安装的 oclint。
我尝试通过终端在 sh 中添加路径,但可能这些路径只是为该 session 添加的,所以仍然会出现相同的错误。
oclint not found, analyzing stopped
Command /bin/sh failed with exit code 1
最佳答案
选项 1:您可以从 Xcode 窗口转到您的 Project Target > Build Phases > Run Script > Shell
来更改它。并选择在输入文本字段中输入类似 /bin/bash
的内容或 /bin/sh
选项2:或者您可以从project.pbxproj文件中更改它,用编辑器打开它,它会在<Your_App>.xcodeproj/project.pbxproj
下。并更新 shellPath
值你看到类似的东西:
/* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 3117423647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "
关于ios - 如何将 xcode 的默认 shell 更改为 bash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24641667/