Skip to content

Debugging Hints

Rolf Bjarne Kvinge edited this page Jan 31, 2023 · 1 revision

Running desktop apps from the command line

Sometimes you get better diagnostic output when executing the native executable directly from the command line (for macOS and Mac Catalyst).

The native executable is located inside the Contents/MacOS directory inside the app bundle, so if the current directory is the project directory, the full app to the executable would be something like:

# A debug build is by default in a subdirectory with the current RuntimeIdentifier:
$ ./bin/Debug/net7.0-macos/osx-x64/MyApp.app/Contents/MacOS/MyApp

# A release build is by default universal:
$ ./bin/Release/net7.0-macos/MyApp.app/Contents/MacOS/MyApp

Set OS_ACTIVITY_DT_MODE to get output to the system log

Set the OS_ACTIVITY_DT_MODE environment variable to YES to get any output written to the system log (typically os_log or NSLog from native code) written to standard error. This is very useful when launching from the command line as explained above:

export OS_ACTIVITY_DT_MODE=Yes
$ ./bin/Debug/net7.0-macos/osx-x64/MyApp.app/Contents/MacOS/MyApp
[...]
Clone this wiki locally