Launching XCTests in LLDB from command line on macOS

Is there a way to run Swift tests from the command line in LLDB on macOS?

On Linux, I am able to do lldb .build/debug/MyPackageTests.xctest. On macOS, I run into two issues:

  1. .build/debug/MyPackageTests.xctest is not an executable, but a bundle and trying to run .build/debug/MyPackageTests.xctest/Contents/MacOS/MyPackageTests gives me an exec format error (my wild guess is that on macOS the tests are a static library which is dynamically loaded).
  2. macOS requires special privileges to attach to a process (as evidenced by Xcode requesting permissions when debugging a local executable) and I'm not sure how to grant these permissions to my shell or lldb. sudo DevToolsSecurity --enable is the only seemingly relevant thing I've found and that doesn't seem to work.

Does anyone in the community have ideas about what I can try next?

Terms of Service

Privacy Policy

Cookie Policy