You must use AppleScript to change the value of SimulateDevice to com.apple.iphonesimulator.plist .
Here is an example that does this after asking the user to select the desired device type. You can change it to read the value from the command line or use "iPhone (Retina)" as the default value.
The following script changes the simulator to a value from the command line:
on run argv set selectedDevice to item 1 of argv as string set thePListFolderPath to path to preferences folder from user domain as string set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist" tell application "System Events" tell property list file thePListPath tell contents set value of property list item "SimulateDevice" to selectedDevice end tell end tell end tell end run
And you can execute it from the terminal using the osascript :
osascript myScript.scpt "iPhone (Retina)"
or
osascript myScript.scpt "iPhone"
Edit
You can modify this script to run the default Retina simulator:
set selectedDevice to "iPhone (Retina)" set thePListFolderPath to path to preferences folder from user domain as string set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist" tell application "System Events" tell property list file thePListPath tell contents set value of property list item "SimulateDevice" to selectedDevice end tell end tell end tell
Finally, note that changes to the "SimulateDevice" take effect when you start a new simulator.
source share