Duplicate apps launched when debugging in Xcode?

I’ve noticed a strange bug in Xcode 16 and Swift. When a preview is rendering and hasn’t finished yet and you run an app to debug, Xcode is launching two instances of the app. Has anyone else noticed this issue? If you let the preview finish rendering before running the app, this doesn’t happen. Very odd.

Answered by DTS Engineer in 807739022
Has anyone else noticed this issue?

This is one of those “does it really matter?” moments. If this is annoying you, please file a bug about it. Some notes:

  • Our Bug Reporting > Profiles and Logs has advice on how to file bugs against Xcode in general and Swift Previews in particular.

  • It’d be great if you included a project that reproduces the problem. If you can’t share your own project, perhaps try reproducing it with an open source project. Or even an Apple sample.

  • Likewise, a screen recording of the issue would be great.

I’d appreciate you posting your bug number, just for the record

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I too am experiencing the same issue. It doesn't seem to happen the first time that I compile after opening Xcode, but every test after that I get multiple instances opening up, sometimes up to three.

This is happening when I'm coding in C using SDL libraries. Xcode version is 16.3

I'll chime in with another "this happened to me as well". Xcode 16.3, when using GLFW to run a metal-cpp program.

Also happening here with Xcode 16.3, a c++ cmd app with SDL UI and setup with cmake. One stopgap solution that mostly works is sleeping for 0.5s (usleep(5e5)) at the beginning of main.

This is one of those “does it really matter?” moments.

This is a joke... right? Of course it matters.

Confirmed on Xcode 16.4 (16F6). Bug symptoms are the same as previously mentioned: Xcode frequently launches duplicate processes when schema Run action is performed on a macOS command line tool executable that creates UI windows.

It is a bug in Xcode due to following:

  1. The bug occurs when "Debug executable" is set under the Scheme -> Run -> Info tab.
  2. When "Debug executable" is unset, no duplicate processes are launched.
  3. No duplicate processes are launched when the executable is launched on terminal.

Also confirmed that adding 350 ms delay in program main() is a workaround. For example, using SDL2 add SDL_Delay(350) at the top of the main() function.

To Xcode team, let me know if you want a test app for this.

Cheers.

Duplicate apps launched when debugging in Xcode?
 
 
Q