Xcode Command Lines Tool 知识点记录

  • Post author:
  • Post category:其他




Xcode Command Lines Tool 是什么

Xcode Command Lines Tool 是终端下xcode开发相关的命令行工具集合。Command Lines Tool这里我们简写为CLT



关键知点



CTL可以有多套,系统默认一个,Xcode IDE自带一个


系统默认的CTL路径为:/Library/Developer/



Xcode IDE的CTL路径为:/Applications/Xcode.app/Contents/Developer



Xcode-Select 可以切换CTL

由于可以存在多配套CLT,所以就存在切换环境的需求,即Xcode-Select就是为此而存在的

$ xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

-p可以查看当前CLT的路径

 xcode-select -p
/Applications/Xcode.app/Contents/Developer
//感觉是安装xcode13后,会是指向xcode13下的CLT



xcrun 可以运行当前CTL下的某个命令

xcrun -h
Usage: xcrun [options] <tool name> ... arguments ...

Find and execute the named command line tool from the active developer
directory.

The active developer directory can be set using `xcode-select`, or via the
DEVELOPER_DIR environment variable. See the xcrun and xcode-select manual
pages for more information.

Options:
  -h, --help                  show this help message and exit
  --version                   show the xcrun version
  -v, --verbose               show verbose logging output
  --sdk <sdk name>            find the tool for the given SDK name
  --toolchain <name>          find the tool for the given toolchain
  -l, --log                   show commands to be executed (with --run)
  -f, --find                  only find and print the tool path
  -r, --run                   find and execute the tool (the default behavior)
  -n, --no-cache              do not use the lookup cache
  -k, --kill-cache            invalidate all existing cache entries
  --show-sdk-path             show selected SDK install path
  --show-sdk-version          show selected SDK version
  --show-sdk-build-version    show selected SDK build version
  --show-sdk-platform-path    show selected SDK platform path
  --show-sdk-platform-version show selected SDK platform version



参考文档



版权声明:本文为SCHOLAR_II原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。