Is there any way to browse the file system of a currently running or just killed iOS simulator? I\'d settle for being able to see a specific app\'s files if there\'s a way t
Old post, but I think it is worth mentioning SimPholders to find your Simulator files. It is a menu bar item that tracks your simulator apps and lets you go directly to their folders and content. It's super awesome.
(original answer here: https://stackoverflow.com/a/26557165/377384)
For Swift 4.2 and higher, print an easy to use path:
#if targetEnvironment(simulator)
print("::::: SIMULATOR :::::")
if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path {
print("App Documents Directory:\n\(documentsPath)\n")
}
#endif
... in a source code location such as:
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// ...
return true
}
Use the resulting path with cd
or open
on the terminal command line. Or, paste the path in the shift-cmd-G
"Go To Folder…" Finder prompt.
Related answer which includes older language versions: Document Directory Path of iOS 8 Beta Simulator
Based on @zsero answer, I made a short bash
script which directly opens the simulator folder of your application id. Very handy!
openappfolder.sh
#!/bin/bash
APPID=$1
if OUTPUT=`xcrun simctl get_app_container booted $APPID data` ; then
open $OUTPUT
else
echo "$APPID not found!"
fi 2>/dev/null
Then just
openappfolder.sh com.bundle.id
~/Library/Developer/CoreSimulator/Devices
~/Library/Developer/CoreSimulator/Devices/{{Device Code}}/data/Containers/Bundle/
On Xcode Version 8.2.1 (8C1002) I found the .app files installed on the simulator in this path: ~/Library/Developer/Xcode/DerivedData/[APPNAME]-[RANDOM HASH]/Build/Products/Debug-iphonesimulator
UPDATE: Since iOS 8:
~/Library/Developer/CoreSimulator/Devices
The location used to be:
~/Library/Application Support/iPhone Simulator
It had directories for all models of simulators (4.0, 4.1, 5.0, etc) you have ever run, go to the one you are running from in Xcode.
Once in a folder, go to Applications, choose the Finder option that shows date for files, and sort by date. Your application will be the most recent since it just changed the directory...
Inside the directory is everything related to your application. You can even drop files in there between runs, to revert back to a stored database in a known state for example...
I go there often enough I keep the iPhone Simulator directory in my Finder sidebar.
Note that with iOS8, the simulator folders are in a totally different directory - really split across a few directories, with folder names for application specific files that change each time you run your app.