macos更新后,在执行某些命令时,出现Xcode command line tools missing xcrun的问题
clang --verson
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
解决方法
重新安装Xcode-select命令
xcode-select --install
安装后便可以正常使用
clang --version
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: x86_64-apple-darwin21.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
补充
xcode-select是什么?
xcode-select
is a command-line utility on OS X that facilitates switching between different sets of command line developer tools provided by Apple. Its primary function is to be a “master switch” for the actual paths resolved when invoking the commands for tools likemake
,xcodebuild
,otool
, etc.
Xcode 和 Xcode command line tools的区别
- The command line tools are the basic foundation. Many basic tools are needed to compile your Swift/Objective-C code.
- XCode is the IDE which brings a few additional packages with it.
So the command line tools get sure that the basic UNIX tools are covered (as GCC for example) to be able to compile and link code.