gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 09:43:33 25 4
gpt4 key购买 nike

嗨,我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com