xcode - 按版本查找Xcode安装路径

标签 xcode command-line makefile installation-path

没有标准路径可以在一个系统上保存不同的 XCode(XCode3 和 XCode4)副本。对于我的 Makefile 或其他基于命令行的构建过程,我正在寻找一种方法来确定特定版本的 XCode 的安装路径 ($DEVELOPER_DIR),将此路径导出为 DEVELOPER_DIR 或使用 xcode-select 使其处于事件状态。

到目前为止,我正在尝试查询 system_profiler 的 xml 输出。

还有其他(更方便)的选择吗?

基本上我需要一个脚本来告诉系统在不知道它们的安装路径的情况下使用 Xcode3(或 Xcode4)。

最佳答案

到目前为止,这是我想出的:

DEVELOPER_DIR=`system_profiler SPDeveloperToolsDataType -xml |\
xpath "//*[text()='spdevtools_version']/following-sibling::string[starts-with(text(),'3')]/../*[text()='spdevtools_path']/following-sibling::string[1]/text()"`

这将 DEVELOPER_DIR 设置为 Xcode3 的安装路径。对于 Xcode4,只需将 '3' 替换为 '4'

当安装了多个版本的 XCode3 时,这将无法正常工作。

关于xcode - 按版本查找Xcode安装路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5926232/

相关文章:

iphone - 为 iPhone 构建 libxslt

MySQL 命令行问题 - 不明确的选项 --s

command-line - 如何查明 .EXE 是否具有命令行选项?

c++ - 生成文件 : Is there are a general way to show which line from makefile is causing the error?

makefile - (GNU make)installcheck一个库

ios - 如何正确使用 UIElements 上的占位符 API

c - 这个简单的 C 程序有什么问题?

ios - 无法使用 Xcode 7.3.1 在我的 Swift 2 项目中使用 "po"检查变量 - 加载辅助函数时出错

python - Python 的 argparse 可以像 gnu getopt 一样置换参数顺序吗?

c - 将 V=s Flage 传播到所有子 makefile