LinuxCommandLibrary

xcode-select

TLDR

Install command line developer tools

$ xcode-select --install
copy
Print the current developer directory path
$ xcode-select -p
copy
Switch to a different Xcode installation
$ sudo xcode-select -s [/Applications/Xcode.app]
copy
Switch to command line tools only
$ sudo xcode-select -s [/Library/Developer/CommandLineTools]
copy
Reset to default developer directory
$ sudo xcode-select -r
copy
Show version information
$ xcode-select --version
copy

SYNOPSIS

xcode-select [-h|-help] [-s path|--switch path] [-p|--print-path] [-r|--reset] [-v|--version] [--install]

DESCRIPTION

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.

PARAMETERS

--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

CAVEATS

The --switch and --reset options require superuser privileges and affect all users on the system. After macOS updates, command line tools may need reinstallation. The --install command requires GUI interaction.

HISTORY

xcode-select has been part of macOS developer tools since Xcode 3. Apple separated Command Line Tools from Xcode proper around 2012, allowing development without the full IDE download.

SEE ALSO

xcrun(1), xcodebuild(1), clang(1), make(1)

Copied to clipboard