简体   繁体   English

查找iOS Simulator应用程序的路径

[英]Finding the path of the iOS Simulator app

I want to run the simulator from the command line. 我想从命令行运行模拟器 Is there any way to find the simulator path through command line . 有什么方法可以通过命令行找到模拟器路径 Apple frequently changes the simulator location like 苹果经常更改模拟器的位置,例如

/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. 有什么办法可以从终端找到模拟器路径。 ?

Here are two suggestions: 这里有两个建议:

  • You can use xcode-select to print the path to Xcode: 您可以使用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 
  • You can use xcrun to find the path of a xcodebuild tool in the iphonesimulator SDK, then deducting the path from here: 您可以使用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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM