Linux command
xcode-select 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install command line developer tools
xcode-select --install
Print the current developer directory path
xcode-select -p
Switch to a different Xcode installation
sudo xcode-select -s [/Applications/Xcode.app]
Switch to command line tools only
sudo xcode-select -s [/Library/Developer/CommandLineTools]
Reset to default developer directory
sudo xcode-select -r
Show version information
xcode-select --version
说明
xcode-select manages the active developer directory on macOS, controlling which Xcode or Command Line Tools installation is used by build tools like xcrun, xcodebuild, clang, and make. The command line tools package includes compilers (clang, gcc), build tools (make, cmake), version control (git, svn), and the macOS SDK. When multiple Xcode versions are installed, xcode-select switches between them. The tools are installed to /Library/Developer/CommandLineTools when using --install without full Xcode, or within /Applications/Xcode.app when using the full IDE.
参数
- --install
- Install the command line developer tools (opens installer dialog)
- -p, --print-path
- Print path to the currently selected developer directory
- -s _path_, --switch _path_
- Set the active developer directory to the specified path (requires sudo)
- -r, --reset
- Reset to default developer directory search (requires sudo)
- -v, --version
- Print xcode-select version
- -h, --help
- Display help information
FAQ
What is the xcode-select command used for?
xcode-select manages the active developer directory on macOS, controlling which Xcode or Command Line Tools installation is used by build tools like xcrun, xcodebuild, clang, and make. The command line tools package includes compilers (clang, gcc), build tools (make, cmake), version control (git, svn), and the macOS SDK. When multiple Xcode versions are installed, xcode-select switches between them. The tools are installed to /Library/Developer/CommandLineTools when using --install without full Xcode, or within /Applications/Xcode.app when using the full IDE.
How do I run a basic xcode-select example?
Run `xcode-select --install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --install do in xcode-select?
Install the command line developer tools (opens installer dialog)