Sometimes you may find it useful to transfer an existing app you deployed on a particular simulator, to another simulator without having to build and run the app again in Xcode.
The main scenario I have in mind is during beta time, when you want to check how an existing app, built with the current version of Xcode, behaves in a simulator running the beta version of iOS.
You can do the same test on a real device where you install the beta and check existing apps from the App Store or installed Ad Hoc, but you may want to do it into the simulator because you’re not a beta enthusiast (I am not, at least on my main iPhone) or because you like working on the simulator.
As you probably guessed reading the title, it is possible, so I’m going to show you two ways you can find the executable on a simulator and install the same app on a different one.
Let’s start with the easiest thing to do.
To install an app on a simulator, you just need to drag it from Finder and drop it on the simulator window. That’s it! 🙂
You’ll see the usual UI of an app installing on the device, just like when you add an app in TestFlight or via the App Store or Ad Hoc.
So the question is, how do we locate an app running on a simulator? There are two ways.
If the app is running, you can look for it on Activity Monitor.
Double click on the name, in my example is TestLive, the same name you read under the icon.
Then go to Open Files and Ports
The first path is ok, copy it before TestLive.app and open it in finder.
There you’ll see a plist and the app, this is the file you can drag&drop on the simulator window to install it.
What if the app is not running?
Then we can use a command line tool to interact with the simulator to find its ID and thus find the directory where all the installed apps are stored.
xcrun simctl list ... list of simulator xcrun simctl list | grep Booted iPhone 11 (6F5EA049-F363-45C3-A37C-2F5BEDB14E05) (Booted) open ~/Library/Developer/CoreSimulator/Devices/6F5EA049-F363-45C3-A37C-2F5BEDB14E05
the first command will print a list of all the available simulators. If your simulator is running, you can use grep to look for the active one, or you can grep for the simulator name so you get straight to the one you need.
The simulators are under ~/Library/Developer/CoreSimulator/Devices so you just need to add the simulator id to that path and you’re done.
Once you open Finder, you’ll see all the apps installed on that particular simulator
our app is there, if you have many of them installed you can look for the name of the app to quickly find it without opening all the folders.
Hope you found this useful for your tests, happy coding 🙂