Is there any way to see the file system on the iOS simulator?

Viewed 102987

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 to do that.

Note that I don't want to do this programatically. I want to see/open the files in the Finder.

12 Answers

Easy. Fast. Xcode 10+.

  1. Use print(NSHomeDirectory()) and copy the path.
  2. Open Finder app and press Shift+Cmd+G
  3. Paste the copied path and press GO

Alternative for 1. is to catch a breakpoint and do po NSHomeDirectory() in console.

If you want to automate getting the location or use that folder in scripting, you can get the precise location from a running simulator with the following command:

xcrun simctl get_app_container booted my.app.id data

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

first, get simulator list with device ID from terminal

  1. instruments -s devices
  2. xcrun simctl list

Then go put device id below path. you will be get specific simulator file system ~/Library/Developer/CoreSimulator/Devices/{{deviceID}}

Related