xcode 查找 iOS Simulator 应用程序的路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12675965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Finding the path of the iOS Simulator app
提问by Muthu
I want to run the simulatorfrom the command line. Is there any way to find the simulator paththrough command line. Apple frequently changes the simulator location like
我想从命令行运行模拟器。有什么办法可以通过命令行找到模拟器路径。Apple 经常更改模拟器位置,例如
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
/Applications ........ / IOS simulato....
Is there any way to find the simulator path from terminal. ?
有什么办法可以从终端找到模拟器路径。?
回答by AliSoftware
Here are two suggestions:
这里有两个建议:
You can use
xcode-selectto print the path to Xcode:# This returns sthg like "/Applications/Xcode.app/Contents/Developer" XCODEPATH=$(xcode-select --print-path) # Then build the rest of the path to the simulator SDK SIMSDKPATH=${XCODEPATH}/Platforms/iPhoneSimulator.platform/Developer # And add the rest of the path to the Simulator app SIMULATORPATH=$(SIMSDK}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone SimulatorYou can use
xcrunto find the path of a xcodebuild tool in the iphonesimulator SDK, then deducting the path from here:# This returns sthg like "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" GCCPATH=$(xcrun -sdk iphonesimulator -find gcc) # Then go up 3 directories SIMSDKPATH=$(dirname $(dirname $(dirname ${GCCPATH}))) # And down to the Simulator app SIMULATORPATH=${SIMSDKPATH}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator
您可以使用
xcode-select打印 Xcode 的路径:# This returns sthg like "/Applications/Xcode.app/Contents/Developer" XCODEPATH=$(xcode-select --print-path) # Then build the rest of the path to the simulator SDK SIMSDKPATH=${XCODEPATH}/Platforms/iPhoneSimulator.platform/Developer # And add the rest of the path to the Simulator app SIMULATORPATH=$(SIMSDK}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator可以使用
xcrun在iphonesimulator SDK中找到xcodebuild工具的路径,然后从这里推导出路径:# This returns sthg like "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" GCCPATH=$(xcrun -sdk iphonesimulator -find gcc) # Then go up 3 directories SIMSDKPATH=$(dirname $(dirname $(dirname ${GCCPATH}))) # And down to the Simulator app SIMULATORPATH=${SIMSDKPATH}/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator

