Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check Xcode version from command line

Tags:

xcode

How do I check Xcode's version from the command line?

I want to be able to check the version number from scripts or remotely via SSH.

like image 267
Afriza N. Arief Avatar asked Nov 16 '15 09:11

Afriza N. Arief


People also ask

How can I see my Xcode version?

Open your Xcode up, head to the menu bar and select Xcode > About Xcode.

How do I know if I have Xcode on my Mac terminal?

We'll use Finder to find out if XCode is installed. In Finder, select the Go pull-down menu, and select Applications. Or just use the short-cut key Command-Shift-A while Finder is active. This should open a new Finder window, showing all the Applications installed on your machine.

How do I find my Xcode version on Mac?

Start Xcode on the Mac. Choose Preferences from the Xcode menu. In the General window, click the Locations tab. On the Location window, check that the Command Line Tools option shows the Xcode version (with which the Command Line Tools were installed).

Which is the latest Xcode version?

Xcode is Apple's integrated development environment (IDE) for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, and tvOS. It was initially released in late 2003; the latest stable release is version 13.4. 1, released on June 2, 2022, via the Mac App Store with macOS Monterey.


Video Answer


2 Answers

$ system_profiler SPDeveloperToolsDataType
Developer:

    Developer Tools:

      Version: 6.1.1 (6A2008a)
      Location: /Applications/Xcode.app
      Applications:
          Xcode: 6.1.1 (6611)
          Instruments: 6.1 (56160)
      SDKs:
          OS X:
              10.10: (14A382)
              10.9: (13F26)
          iOS:
              8.1: (12B411)
          iOS Simulator:
              7.1: (11D167)
              8.1: (12B411)

also check out xcrun man page (man xcrun) and xcode-select along with xcodebuild from the other answer.

like image 62
Afriza N. Arief Avatar answered Oct 09 '22 22:10

Afriza N. Arief


For mac users, running the below from the terminal will work:

$ xcodebuild -version
Xcode 11.3.1
Build version 11C505

additionally, the exit code is standard 0 for success and 1 if CommandLineTools is configured instead of Xcode

% xcodebuild -version ; echo "# exit code: $?"
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
# exit code: 1
like image 2
Green Avatar answered Oct 09 '22 22:10

Green