打开指定版本的 Xcode 项目文件
使用首选 Xcode 版本打开项目文件
xc
使用 Xcode 14.2.0 打开项目文件
xc -v 14.2.0
xc list
---
Available Xcode:
14.2 /Applications/Xcode.app <xcode-select>
14.1 /Applications/Xcode14.1.app
13.4.1 /Applications/Xcode13.4.1.app
13.2.1 /Applications/Xcode13.2.1.app
.xcworkspace
.xcodeproj
Package.swift
.xcode-version
$ xcode-select
通过 NSWorkspace.shared.urlsForApplications(withBundleIdentifier: "com.apple.dt.Xcode")
自动搜索 Xcode。
xc list
---
Available Xcode:
14.2 /Applications/Xcode.app <xcode-select>
14.1 /Applications/Xcode14.1.app
13.4.1 /Applications/Xcode13.4.1.app
13.2.1 /Applications/Xcode13.2.1.app
只需运行
xc -n
当你执行 xc
或 xc open
命令时,自动执行 sudo xcode-select --switch
。这需要 sudo 密码。你可以通过 $ xc config
设置 sudo 密码
警告
此功能默认禁用。
你可以通过执行以下命令启用此功能。
$ xc config write --sudo-password <sudo-password> --auto-xcode-select-enabled true
此命令构建于 swift-argument-parser 之上。
请参考 这篇文章。
将 example
替换为 xc
。
brew install s2mr/tap/xc
将以下内容添加到你的 Package.swift
文件的依赖项中
dependencies: [
.package(url: "https://github.com/s2mr/xc.git", from: "xc version"),
]
运行命令
swift run -c release xc [COMMAND] [OPTIONS]
通过以下命令使用 Mint 安装
mint install s2mr/xc
运行命令
mint run s2mr/xc [COMMAND] [OPTIONS]
你也可以通过从最新的 GitHub 版本下载 xc.zip
来安装 xc。
xc --help
---
OVERVIEW: This tool launches the Xcode application and opens the given documents.
USAGE: xc <subcommand>
OPTIONS:
--version Show the version.
-h, --help Show help information.
SUBCOMMANDS:
list Available Xcodes list
open (default) Shows available versions of Xcode
config Read and write xc command config. Config json is stored at `~/.config/xc/config.json`
env Current environment
See 'xc help <subcommand>' for detailed help.
xc open --help
---
OVERVIEW: Shows available versions of Xcode
USAGE: xc open [-v <v>] [<path>]
ARGUMENTS:
<path> File path
OPTIONS:
-v <v> Open with specific Xcode version
--version Show the version.
-h, --help Show help information.