xcode - 为什么在这个构建脚本中是 "xcodebuild: command not found"?

标签 xcode bash sh xcodebuild

嗨,我的 xcode 项目的根目录中有以下内容:

#!/bin/bash
xcodebuild -scheme target1 clean;
xcodebuild -scheme target1 archive;
xcodebuild -scheme target2 clean;
xcodebuild -scheme target2 archive;

但是,这只执行第一行 xcodebuild -scheme target1 clean;然后产生
...
** CLEAN SUCCEEDED **

xcodebuild: command not found
xcodebuild: command not found
xcodebuild: command not found

免责声明:我是绝对的 Mac OS X/Unix 新手。

编辑 :按照 kranteg 的建议,我在脚本中添加了 pwd:
#!/bin/bash
pwd;
xcodebuild -scheme target1 clean;
pwd;
xcodebuild -scheme target1 archive;
pwd;
xcodebuild -scheme target2 clean;
pwd;
xcodebuild -scheme target2 archive;
pwd;

输出:
/Users/CKU/Programme/uraClient
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

Check dependencies

<... lots of compiler messages about the clean ...>

** CLEAN SUCCEEDED **

/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient
xcodebuild: command not found
/Users/CKU/Programme/uraClient

编辑 2 :用 echo $PATH 替换 pwd 会产生更好的结果,现在脚本在失败之前执行前三个 xcodebuild 命令。但是,PATH 变量似乎不受 xcodebuild 的影响:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ...>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== BUILD TARGET uraClient OF PROJECT uraClient WITH CONFIGURATION Release ===

<... log messages ...>

** ARCHIVE SUCCEEDED **


The following commands produced analyzer issues:
    AnalyzeShallow uraClient/SQLiteLibrary/SQLiteManager.m
    AnalyzeShallow uraClient/URA/NSString+UrlEncoding.m
    AnalyzeShallow uraClient/Services/UraTripPredictionsProvider.m
    AnalyzeShallow uraClient/UtilityAppViewController/ViewController.m
    AnalyzeShallow uraClient/RNCryptor/RNDecryptor.m
    AnalyzeShallow uraClient/RNCryptor/RNEncryptor.m
    AnalyzeShallow uraClient/RNCryptor/RNOpenSSLCryptor.m
    AnalyzeShallow uraClient/RNCryptor/RNOpenSSLDecryptor.m
    AnalyzeShallow uraClient/RNCryptor/RNOpenSSLEncryptor.m
(9 commands with analyzer issues)
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
=== CLEAN TARGET uraAseag OF PROJECT uraClient WITH CONFIGURATION Debug ===

<... log messages ..>

** CLEAN SUCCEEDED **

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools
xcodebuild: command not found
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Desktop/adt-bundle-mac-x86_64-20130522/sdk/platform-tools

最佳答案

xcodebuild当没有为 xcode 设置命令行工具时,命令将不起作用。

确保选择了最新的命令行工具(在 Xcode > Preferences > Locations 下)

enter image description here

关于xcode - 为什么在这个构建脚本中是 "xcodebuild: command not found"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24445229/

相关文章:

bash - 删除目录下文件下划线

linux - inotifywait 在脚本运行时错过事件

linux - 如何检查 Bash 中的两条路径是否相等?

bash - 在 ffmpeg 流上添加图像

ios - Xcode:如何修复线程 5:EXC_BREAKPOINT(代码=1,子代码=0x10025c76c)

ios - UITableView在屏幕上点击之前不可见

xcode - IBDesignables,找不到合适的图像,缺少所需的代码签名

ios - '"_vDSP maxvD”错误,引用自...”在实现核心图时

mysql - 编辑 Bash 脚本以显示输出

linux - 列出最近 5 个隐藏目录的内容