How can I find out if I have Xcode commandline tools installed?
if you want to know the install version of Xcode as well as Swift language current version:
Use below simple command by using Terminal:
1. To get install Xcode Version
xcodebuild -version
2. To get install Swift language Version
swift --version
/usr/bin/xcodebuild -version
will give you the xcode version, run it via Terminal command
This command allows you to retrieve Xcode version when having only the CommandLineTools
version installed:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
As per this answer to "Determine xcode command line tools version" on Ask Different
Notes:
- Confirmed working on maxOS Sierra and Big Sur.
- When only CommandLineTools is install without Xcode, using xcodebuild returns the following error:
# /usr/bin/xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
First of all, be sure that you have downloaded it or not. Open up your terminal application, and enter $ gcc
if you have not installed it you will get an alert. You can verify that you have installed it by
$ xcode-select -p
/Library/Developer/CommandLineTools
And to be sure then enter $ gcc --version
You can read more about the process here: Xcode command line tools for Mavericks