Check Xcode and SDK Versions via Command

A quick memo on how to check Xcode and SDK versions using the CLI.

Introduction

When installing tools on a Mac, there may be dependencies requiring specific versions of Xcode and SDKs (such as macOS SDK, iOS SDK, etc.).

I wasn't sure how to check them quickly, so I'm leaving this memo.

Note: This article was translated from my original post.

Check Xcode and SDK Versions via Command

Method

You can check the versions of Xcode and SDKs using the following commands.

To check the Xcode version:

xcodebuild -version


To check the SDK versions:

xcodebuild -showsdks

Examples

Let's look at some actual execution examples.

Example of checking the Xcode version with xcodebuild -version:

$ xcodebuild -version
Xcode 15.4
Build version 15F31d


Example of checking the SDK versions with xcodebuild -showsdks:

$ xcodebuild -showsdks
DriverKit SDKs:
    DriverKit 23.5                    -sdk driverkit23.5

iOS SDKs:
    iOS 17.5                          -sdk iphoneos17.5

iOS Simulator SDKs:
    Simulator - iOS 17.5              -sdk iphonesimulator17.5

macOS SDKs:
    macOS 14.5                        -sdk macosx14.5
    macOS 14.5                        -sdk macosx14.5

tvOS SDKs:
    tvOS 17.5                         -sdk appletvos17.5

tvOS Simulator SDKs:
    Simulator - tvOS 17.5             -sdk appletvsimulator17.5

visionOS SDKs:
    visionOS 1.2                      -sdk xros1.2

visionOS Simulator SDKs:
    Simulator - visionOS 1.2          -sdk xrsimulator1.2

watchOS SDKs:
    watchOS 10.5                      -sdk watchos10.5

watchOS Simulator SDKs:
    Simulator - watchOS 10.5          -sdk watchsimulator10.5

Conclusion

I've been using Linux (Ubuntu) as my development environment for a long time, so I often encounter things I don't know in the Mac environment.

I hope this helps someone!

References