simctl launch --console flag doesn't seem to work?

I created a simple app in Xcode. Installed and ran it in the iOS Simulator. I can also start it from command line like this:

% xcrun simctl launch booted com.example.TestBuildCommands --console
com.example.TestBuildCommands: 52877
%

It just prints that one line and returns my shell prompt. But the help for launch says that --console should: "Block and print the application's stdout and stderr to the current terminal."

In my main() function I have:

int main(int argc, char * argv[]) {
    printf("In main.\n");
    ...

Shouldn't I be seeing that message in my terminal screen?

% xcrun simctl help launch                                               
Launch an application by identifier on a device.
Usage: simctl launch [-w | --wait-for-debugger] [--console|--console-pty] [--stdout=<path>] [--stderr=<path>] [--terminate-running-process] <device> <app bundle identifier> [<argv 1> <argv 2> ... <argv n>]

	--console Block and print the application's stdout and stderr to the current terminal.
		Signals received by simctl are passed through to the application.
		(Cannot be combined with --stdout or --stderr)
    [...]

ps. Anyone know how to turn off syntax highlighting in those triple-backquoted code blocks that are meant to be just terminal text, not highlighted code?

Post not yet marked as solved Up vote post of rnikander Down vote post of rnikander
624 views

Replies

Hi @rnikander,

Per simctl help launch usage message, all arguments that are passed after the <bundle identifier> are directly passed to the spawned application (I guess via usual argv[] vector). --console should thus be specified before the bundle identifier, as in.

% xcrun simctl launch --console booted com.example.TestBuildCommands

Cheers, Javier.