93

In iOS 7, the document directory of the iOS simulators can be found in:

/Users/Sabo/Library/Application Support/iPhone Simulator/

However, in iOS 8 Beta Simulator, I can't find the corresponding directory for iOS 8 in the directory above.

Where's the document directory path for the iOS 8 Simulator?

enter image description here

Leo Dabus
  • 198,248
  • 51
  • 423
  • 494
Fire Fist
  • 6,911
  • 12
  • 59
  • 107
  • Try [this](http://nsrover.wordpress.com/2014/11/28/ios8-simulator-documents-directory/). There is an app which directly opens the Documents directory of the latest app run. – NSRover Nov 28 '14 at 11:39
  • http://stackoverflow.com/questions/24290989/xcode-6-iphone-simulator-application-support-location – Amar Dec 04 '14 at 09:08
  • try this link http://stackoverflow.com/questions/24133022/ios-8-store-sqlite-file-location-core-data/27461267#27461267 – Tunvir Rahman Tusher Apr 18 '15 at 17:04
  • If you can't find your library folder it is probably hidden. Typing this command into the terminal will unhide it: chflags nohidden ~/Library – simon_smiley May 14 '15 at 11:09
  • If you like Xcode plugin, try https://github.com/onmyway133/XcodeWay, an Xcode plugin that can navigate to your simulator folder, and many other places – onmyway133 May 15 '16 at 21:22

21 Answers21

156

on my computer, the path is:

~/Library/Developer/CoreSimulator/Devices/1A8DF360-B0A6-4815-95F3-68A6AB0BCC78/data/Container/Data/Application/

NOTE: probably those long IDs (i.e UDIDs) are different on your computer.

holex
  • 23,420
  • 7
  • 59
  • 73
  • 1
    If your app uses CoreData, there may be an easier way to search for the folder location: http://stackoverflow.com/a/25937606/1103584 – DiscDev Sep 19 '14 at 15:42
  • 13
    No, this is incorrect. There is no distinction between ObjC projects and Swift projects. Those are UDIDs (Unique Device IDentifiers) and you can see yours by running 'xcrun simctl list' – Jeremy Huddleston Sequoia Sep 19 '14 at 22:56
  • @JeremyHuddlestonSequoia, correct or not, that is how the _Swift_ and an _ObjC_ project was copied on my computer. I don't need to mention both were compiled on simulator only (that was the original question). if the _Xcode_ makes difference between UDIDs for different languages, and you think it is not correct, you may need to report it to Apple. – holex Sep 21 '14 at 11:59
  • 7
    Holex, I'm saying that your statement is incorrect, not that the design is incorrect (note that I'm actually the guy at Apple that designed CoreSimulator, so I'd probably be the first person to correct something there that I think is wrong). The UDIDs correspond to separate devices. The only reason your swift and objc projects would be using different UDIDs is because you deployed your projects to different simulator devices (eg: for one, you deployed to iPhone 5s and the other you deployed to iPhone 6). – Jeremy Huddleston Sequoia Sep 22 '14 at 22:09
  • @JeremyHuddlestonSequoia, you are very welcome to correct my answer anytime, if you feel confident enough. – holex Sep 24 '14 at 08:08
  • you can find your UDIDs from the list of devices from xCode. Select the Simulator you deployed your app onto and then see the Identifier value. THe lousy thing about this new "organization" is that it is NOT documented where your documents, apps, core data files are located, you'll have to break your neck trying to find out that. – carlos_ms Oct 30 '14 at 22:51
  • At the app start you can read the location of documents directory and (in simulator) create a symlink to it with an easy path. I described this approach here in a post: http://blog.brightinventions.pl/quickly-access-application-documents-directory/ – mgamer Dec 03 '15 at 13:59
80

NSLog below code somewhere in "AppDelegate", run your project and follow the path. This will be easy for you to get to the documents rather than searching randomly inside "~/Library/Developer/CoreSimulator/Devices/"

Objective-C

NSLog(@"%@",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);

Swift
If you are using Swift 1.2, use the code below which will only output in development when using the Simulator because of the #if #endif block:

#if arch(i386) || arch(x86_64)
  let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString
  NSLog("Document Path: %@", documentsPath)
#endif

Copy your path from "/Users/ankur/Library/Developer/CoreSimulator/Devices/7BA821..." go to "Finder" and then "Go to Folder" or command + shift + g and paste your path, let the mac take you to your documents directory :)

Varun Kumar
  • 346
  • 2
  • 23
Ankur
  • 5,018
  • 19
  • 35
  • 62
43

Just write bellow code in AppDelegate -> didFinishLaunchingWithOptions
Objective C

#if TARGET_IPHONE_SIMULATOR 
// where are you? 
NSLog(@"Documents Directory: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]); 
#endif 


Swift 2.X

if let documentsPath = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first?.path {
    print("Documents Directory: " + documentsPath)   
}

Swift 3.X

#if arch(i386) || arch(x86_64)
    if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path {
        print("Documents Directory: \(documentsPath)")
    }
#endif

Swift 4.2

#if targetEnvironment(simulator)
    if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path {
        print("Documents Directory: \(documentsPath)")
    }
#endif

Output
/Users/mitul_marsonia/Library/Developer/CoreSimulator/Devices/E701C1E9-FCED-4428-A36F-17B32D32918A/data/Containers/Data/Application/25174F64-7130-4B91-BC41-AC74257CCC6E/Documents

Copy your path from "/Users/mitul_marsonia/Library/Developer/CoreSimulator/Devices/E701C1E9-FCED-4428-A36F-17B32D32918A..." go to "Finder" and then "Go to Folder" or command + shift + g and paste your path, let the mac take you to your documents directory

mxcl
  • 24,446
  • 11
  • 91
  • 95
Mitul Marsoniya
  • 5,106
  • 3
  • 28
  • 53
  • How are you going to know which folder your app is contained? There are too many directories, do I have to search each of that? – KarenAnne Oct 02 '14 at 09:12
  • your ans is hear > http://stackoverflow.com/questions/24133022/ios-8-store-sqlite-file-location-core-data – Mitul Marsoniya Oct 27 '14 at 07:00
  • this is a hardcoded path to your own simulator. It won't work for anyone else. Actually this path will also change for you once you run the simulator again. – NSRover Jan 19 '15 at 05:03
  • #if TARGET_IPHONE_SIMULATOR // where are you? NSLog(@"Documents Directory: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]); #endif – Mitul Marsoniya Jan 19 '15 at 10:29
18

I recommend a nice utility app called SimPholders that makes it easy to find the files and folders while developing your iOS app. It has a new version to work with the new simulators called SimPholders2. It can be found at simpholders.com

JDibble
  • 694
  • 8
  • 25
18

Despite the fact that here are many answers, none of them provides an understanding of how the folder structure of the iOS 8.3 simulators have changed and are not providing a quick way to find the App's Data (Documents folder).

Since iOS 8 the Data storage folder(s) of an App are separate from the App's executable files while the iOS 7 and below are having the same folder structure, the only difference being the fact that all the simulators (different types and versions) are now in one, big folder.

So, the path to an iOS 8,7,6 simulator is the following:

~/Library/Developer/CoreSimulator/Devices

Every simulator is now contained in a folder named with an unique identifier which changes at every reset of a simulator.

You can find the Identifier for each of your devices & simulators by going to Xcode > Window > Devices (the first 3 or 4 characters of the identifier are more than enough to remember).

To find the one on which you have installed your app(s) on, take a look at your Run scheme > devices (screen 2).

screen 1

screen 2

Now, after you identify your simulator, depending on its version the folder structure is very different:

On iOS 8 the executable and the data folder of an app are in different folders:

Executable: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Bundle/Application/[appID]

Data Folder: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Data/Application/[appID]/

Documents Folder: ~/Library/Developer/CoreSimulator/Devices/[simID]/data/Containers/Data/Application/[appID]/Documents

On iOS 7 and below the folder structure is the same as before only remember that now every simulator is in the same folder (see above).

Razvan
  • 3,972
  • 2
  • 22
  • 43
13

If your app uses CoreData, a nifty trick is to search for the name of the sqlite file using terminal.

find ~ -name my_app_db_name.sqlite

The results will list the full file paths to any simulators that have run your app.

I really wish Apple would just add a button to the iOS Simulator file menu like "Reveal Documents folder in Finder".

DiscDev
  • 36,864
  • 20
  • 113
  • 130
11

It is correct that we need to look into the path ~/Library/Developer/CoreSimulator/Devices/.

But the issue I am seeing is that the path keeps changing every time I run the app. The path contains another set of long IDs after the Application string and that keeps changing every time I run the app. This basically means that my app will not have any cached data when it runs the next time.

Deepak G M
  • 1,593
  • 16
  • 12
9

With iOS 9.2 and Xcode 7.2, the following script will open the Documents folder of the last installed application on the last used simulator;

cd ~/Library/Developer/CoreSimulator/Devices/
cd `ls -t | head -n 1`/data/Containers/Data/Application 
cd `ls -t | head -n 1`/Documents
open .

To create an easy runnable script, put it in an Automator Application with "Run Shell Script":

Run Shell Script inside Automator Application

Bouke
  • 10,025
  • 6
  • 49
  • 88
7

With the adoption of CoreSimulator in Xcode 6.0, the data directories are per-device rather than per-version. The data directory is ~/Library/Developer/CoreSimulator/Devices//data where can be determined from 'xcrun simctl list'

Note that you can safely delete ~/Library/Application Support/iPhone Simulator and ~/Library/Logs/iOS Simulator if you don't plan on needing to roll back to Xcode 5.x or earlier.

Jeremy Huddleston Sequoia
  • 21,715
  • 5
  • 69
  • 82
  • Thanks for giving what can probably be seen as the authoritative answer. Is there an easy way (except logging from within the app) to find a specific app's location inside a simulator? – fzwo Oct 09 '14 at 15:31
  • Sorry, no, but I've seen a few requests for this here and on the forums. Please file a radar at http://bugreport.apple.com – Jeremy Huddleston Sequoia Nov 27 '14 at 06:30
7

update: Xcode 11.5 • Swift 5.2

if let documentsPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.path {
    print(documentsPath)   // "var/folder/.../documents\n" copy the full path
}

Go to your Finder press command-shift-g (or Go > Go to Folder... under the menu bar) and paste that full path "var/folder/.../documents" there and press go.

Leo Dabus
  • 198,248
  • 51
  • 423
  • 494
4

Try ~/Library/Developer/CoreSimulator/Devices/

Droppy
  • 9,470
  • 1
  • 18
  • 27
4

I faced the same issue when I stored the full path using CoreData. When retrieving the full path, it return null because the document folder UUID is different every time the app restarts. Following is my resolution:

  1. Make sure storing only the relative path of the document / file in CoreData. E.g. store "Files/image.jpg" instead of "/Users/yourname/.../Applications/UUID/Document/Files/image.jpg".
  2. Use the following to retrieve the app document location:

    [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];

  3. Concatenate both #2 and #1 to get the full path of the document / file you want to retrieve.
You can refer to Apple Developer Note: https://developer.apple.com/library/ios/technotes/tn2406/_index.html
netliner
  • 159
  • 1
  • 4
3

Where is the Documents Directory for the iOS 8 Simulator

You may have noticed that the iPhone Simulator has changed with Xcode 6, and with it – of course – the path to your simulated apps’ Documents Directory. At times we may need to take a look at it.

Finding that path is not as easy as it was once, namely Library/Application Support/iPhone Simulator/7.1/Applications/ followed by a cryptic number representing your app.

As of Xcode 6 and iOS 8 you’ll find it here: Library/Developer/CoreSimulator/Devices/cryptic number/data/Containers/Data/Application/cryptic number

http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/

jbchitaliya
  • 211
  • 2
  • 13
3

in Appdelegate, put this code to see Document and Cache Dir:

#if TARGET_IPHONE_SIMULATOR
    NSLog(@"Documents Directory: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
    NSArray* cachePathArray = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString* cachePath = [cachePathArray lastObject];
    NSLog(@"Cache Directory: %@", cachePath);
#endif

on Log:

Documents Directory: /Users/xxx/Library/Developer/CoreSimulator/Devices/F90BBF76-C3F8-4040-9C1E-448FAE38FA5E/data/Containers/Data/Application/3F3F6E12-EDD4-4C46-BFC3-58EB64D4BCCB/Documents/

Cache Directory: /Users/xxx/Library/Developer/CoreSimulator/Devices/F90BBF76-C3F8-4040-9C1E-448FAE38FA5E/data/Containers/Data/Application/3F3F6E12-EDD4-4C46-BFC3-58EB64D4BCCB/Library/Caches

ikanimo
  • 451
  • 1
  • 4
  • 18
3

If you like to go into the app folders to see what's going on and don't want to have to go through labyrinthine UUDID's, I made this: https://github.com/kallewoof/plget

and using it, I made this: https://gist.github.com/kallewoof/de4899aabde564f62687

Basically, when I want to go to some app's folder, I do:

$ cd ~/iosapps
$ ./app.sh
$ ls -l
total 152
lrwxr-xr-x  1 me  staff    72 Nov 14 17:15 My App Beta-iOS-7-1_iPad-Retina.iapp -> iOS-7-1_iPad-Retina.dr/Applications/BD660795-9131-4A5A-9A5D-074459F6A4BF
lrwxr-xr-x  1 me  staff    72 Nov 14 17:15 Other App Beta-iOS-7-1_iPad-Retina.iapp -> iOS-7-1_iPad-Retina.dr/Applications/A74C9F8B-37E0-4D89-80F9-48A15599D404
lrwxr-xr-x  1 me  staff    72 Nov 14 17:15 My App-iOS-7-1_iPad-Retina.iapp -> iOS-7-1_iPad-Retina.dr/Applications/07BA5718-CF3B-42C7-B501-762E02F9756E
lrwxr-xr-x  1 me  staff    72 Nov 14 17:15 Other App-iOS-7-1_iPad-Retina.iapp -> iOS-7-1_iPad-Retina.dr/Applications/5A4642A4-B598-429F-ADC9-BB15D5CEE9B0
-rwxr-xr-x  1 me  staff  3282 Nov 14 17:04 app.sh
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 com.mycompany.app1-iOS-8-0_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/129FE671-F8D2-446D-9B69-DE56F1AC80B9/data/Containers/Data/Application/69F7E3EF-B450-4840-826D-3830E79C247A
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 com.mycompany.app1-iOS-8-1_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/414E8875-8875-4088-B17A-200202219A34/data/Containers/Data/Application/976D1E91-DA9E-4DA0-800D-52D1AE527AC6
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 com.mycompany.app1beta-iOS-8-0_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/129FE671-F8D2-446D-9B69-DE56F1AC80B9/data/Containers/Data/Application/473F8259-EE11-4417-B04E-6FBA7BF2ED05
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 com.mycompany.app1beta-iOS-8-1_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/414E8875-8875-4088-B17A-200202219A34/data/Containers/Data/Application/CB21C38E-B978-4B8F-99D1-EAC7F10BD894
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 com.mycompany.otherapp-iOS-8-1_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/414E8875-8875-4088-B17A-200202219A34/data/Containers/Data/Application/DE3FF8F1-303D-41FA-AD8D-43B22DDADCDE
lrwxr-xr-x  1 me  staff    51 Nov 14 17:15 iOS-7-1_iPad-Retina.dr -> simulator/4DC11775-F2B5-4447-98EB-FC5C1DB562AD/data
lrwxr-xr-x  1 me  staff    51 Nov 14 17:15 iOS-8-0_iPad-2.dr -> simulator/6FC02AE7-27B4-4DBF-92F1-CCFEBDCAC5EE/data
lrwxr-xr-x  1 me  staff    51 Nov 14 17:15 iOS-8-0_iPad-Retina.dr -> simulator/129FE671-F8D2-446D-9B69-DE56F1AC80B9/data
lrwxr-xr-x  1 me  staff    51 Nov 14 17:15 iOS-8-1_iPad-Retina.dr -> simulator/414E8875-8875-4088-B17A-200202219A34/data
lrwxr-xr-x  1 me  staff   158 Nov 14 17:15 org.cocoapods.demo.pajdeg-iOS-8-0_iPad-Retina.iapp -> /Users/me/Library/Developer/CoreSimulator/Devices/129FE671-F8D2-446D-9B69-DE56F1AC80B9/data/Containers/Data/Application/C3069623-D55D-462C-82E0-E896C942F7DE
lrwxr-xr-x  1 me  staff    51 Nov 14 17:15 simulator -> /Users/me/Library/Developer/CoreSimulator/Devices

The ./app.sh part syncs the links. It is necessary basically always nowadays as apps change UUID for every run in Xcode as of 6.0. Also, unfortunately, apps are by bundle id for 8.x and by app name for < 8.

Kalle
  • 12,846
  • 7
  • 58
  • 74
3

Based on Ankur's answer but for us Swift users:

let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
println("Possible sqlite file: \(urls)")

Put it inside ViewDidLoad and it will print out immediately upon execution of the app.

kakubei
  • 4,942
  • 1
  • 37
  • 61
3

The simulators are located under:

~/Library/Developer/CoreSimulator/

Here, they are listed as directories with UUID names. Use sort by 'Date modified' to find the latest one. Inside navigate to:

/data/Containers/Data/Application/

Here you will get a list of all the applications on that device. You can again sort this to get the latest app.

NOTE: Xcode changes the directory name every time you run the app, so don't rely on making alias/short cuts on desktop.

The easiest way is to use the app here, which does everything automatically.

NSRover
  • 872
  • 1
  • 12
  • 28
2

The simulator directory has been moved with Xcode 6 beta to...

 ~/Library/Developer/CoreSimulator

Browsing the directory to your app's Documents folder is a bit more arduous, e.g.,

~/Library/Developer/CoreSimulator/Devices/4D2D127A-7103-41B2-872B-2DB891B978A2/data/Containers/Data/Application/0323215C-2B91-47F7-BE81-EB24B4DA7339/Documents/MyApp.sqlite
hmdeep
  • 3,005
  • 3
  • 12
  • 22
2

The best way to find the path is to do via code.

Using Swift, just paste the code below inside the function application in your AppDelegate.swift

let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let documentsPath = paths.first as String
println(documentsPath)

For Obj-C code, look answer from @Ankur

Leo Dabus
  • 198,248
  • 51
  • 423
  • 494
rsc
  • 9,304
  • 4
  • 32
  • 31
2

For Swift 3.x

if let documentsPath = FileManager.default.urls(for:.documentDirectory, in: .userDomainMask).first?.path {
        print("Documents Directory: " + documentsPath)
    }
Boris
  • 10,181
  • 1
  • 27
  • 30
1

iOS 11

if let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory,
                                                           .userDomainMask,
                                                           true).first {
    debugPrint("documentsPath = \(documentsPath)")
}
Community
  • 1
  • 1
SwiftArchitect
  • 43,382
  • 25
  • 129
  • 168