如何确定我拥有哪个 iOS SDK?

我相信这很简单,但是如何确定我当前安装的 iOS SDK 的版本呢?

89982 次浏览

Update: Thanks to Stan for showing how to do it with Xcode 4.3 on Lion:

ls /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/‌​SDKs/

The following command shows a listing of all the iPhone SDKs installed on your computer.

ls /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

If you care about the build number (like "10B61"), especially during betas, the best place to check which version of Xcode and related SDKs you have installed is to use "System Information".

Apple Menu > About This Mac > System Report > Software > Developer

Once there, you'll see version and build numbers for all of the major components of the Developer Tools. The top level version and build number corresponds to the name of the disk image you downloaded from Apple.

This is as of macOS 10.14.3.

For latest version of MAC OS Mountain lion:

Apple Menu > About this Mac > More Info... > System Report... > Software > Developer

You will find Developer information like this:

Version: 4.6 (4H127) Location: /Applications/Xcode.app Applications: Xcode: 4.6 (2066) Instruments: 4.6 (46000) SDKs: OS X: 10.7: (11E52) 10.8: (12C37) iOS: 6.1: (10B141) iOS Simulator: 6.1: (10B141)

If you type this:

$> xcodebuild -showsdks

it gives something like this:

$> OS X SDKs:
OS X 10.8                       -sdk macosx10.8
OS X 10.9                       -sdk macosx10.9


iOS SDKs:
iOS 6.1                         -sdk iphoneos6.1
iOS 7.0                         -sdk iphoneos7.0


iOS Simulator SDKs:
Simulator - iOS 6.0             -sdk iphonesimulator6.0
Simulator - iOS 6.1             -sdk iphonesimulator6.1
Simulator - iOS 7.0             -sdk iphonesimulator7.0

The simplest why I found is to run this command line:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

OR, if you have multiple XCode versions:

sudo xcode-select -switch /Applications/Xcode<version_number>.app/Contents/Developer

fastlane isn't able to successfully execute that command so it sounds like that you don't have an Xcode version selected for xcodebuild to run things with. Running the xcode-select command above should do the trick for you ;)

Source: https://github.com/fastlane/fastlane/issues/12784

from the desktop: utilities/system information/software/developer -- lists the installed SDK's

xcode-select --print-path #print your current path Probably this path
/Library/Developer/CommandLineTools


sudo xcode-select --reset #reset to the default command line tools path




xcode-select --print-path# the default should this path
/Applications/Xcode.app/Contents/Developer




xcrun -sdk iphonesimulator --show-sdk-path #the path: /usr/bin/xcrun
#should to print the num of iPhoneSimulator:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator{num}.sdk