Running multiple instances of iOS Simulator and debugging them.

Running multiple instances…

Running multiple instances of “iOS Simulator” is usually very helpful for testing your applications with different user credentials. By default, it is not allowed to run a second (or more) instance from XCode. However, as you can easily find on the net, it is possible to do it using Terminal. You can simply change directory into package and run simulator with “open” command. Here is an example from stackoverflow

There are couple of tricks. First of all, you need to install your application into simulator by running it from XCode and you should do it for every iOS version and platform separately. Also you can not run multiple simulator instances for same hardware type. So, right after seeing the error message “Unable to boot device in current state: Booted”, change device hardware type from

This is good enough for many of the cases. We can test the app on different simulator instances like two different users. But what if we want to debug the application if we see a problem.


We can use XCode’s “Debug” menu to attach debugger to running simulator application processes.

Let’s launch the XCode and open your development project. For each simulator hardware type; you should have run your app inside XCode at least for once. Otherwise you wouldn’t see your app inside your simulator.

I ran same application on two different iOS Simulator instances (iPhone5 and iPhone6) for this example. Here is what you will( or should) see when you go to “XCode->Debug->Attach to Process” menu, as the applications were running simultaneously. XCode is somehow (probably using process names) creating a new group under menu which is named “Likely Targets”. As you can see we have two running instance of our applications with different process id’s.

Screen Shot 2015-04-17 at 10.55.41 PM

We can connect to these instances by selecting them on the menu. You will find that all XCode debugging functionality(breakpoints, thread view, memory info, cpu info, lldb commands etc.) will be working without any problem. Again, you can connect to all of the running instances at the same time. XCode will beautiful display them under “Debugger navigator”

The only problem is that finding correct process id of your app for being sure to debug correct instance. The window title of the simulator is not helpful at this time and we don’t have any clue about the running instances under XCode “Debug” menu.

I can recommend couple of things to identify your process at this point.

Let’s say you have two running simulators with iPhone 5 and iPhone 6 respectively and you want to debug iPhone 5. Add a breakpoint at somewhere in your code that you can easily test (like viewDidLoad event for a known view controller). If your simulator stops when you launch this screen then it means you are debugging correct process. Otherwise, alternate other instances until you find it.

The other method would be trying to find the process id. To do that, go to your simulator window, that you want to debug, and activate it. Kill the iOS application if it is already running. Turn back to XCode and check “XCode->Debug->Attach to Process” menu. Run the application in the simulator that you want to debug and re-check “XCode->Debug->Attach to Process” menu. The newcomer item under “Likely Targets” is your application.

Hope it helps!