21

I am creating an application that write some data to the database. For checking I need to open the database in applications.

I think it should be in

~/Library/Application Support/iphone simulator....

I have not found the iphone simulator folder in Application Support.I have installed ios 4.2, and simulator is working properly.

Where can I find it?

Brian Webster
  • 27,545
  • 47
  • 143
  • 218
Arvind
  • 543
  • 1
  • 5
  • 17
  • Try this method.My answer posted here. http://stackoverflow.com/questions/7731518/no-iphone-simulator-folder-in-application-support/8784630#8784630 – Gajendra K Chauhan May 09 '12 at 09:35
  • Possible duplicate of [Is there any way to see the file system on the iOS simulator?](https://stackoverflow.com/questions/6480607/is-there-any-way-to-see-the-file-system-on-the-ios-simulator) – BB9z Jan 19 '18 at 09:10

11 Answers11

29

Xcode versions 3.x-5.x

Simulator usually is installed together with SDK so most probably you should look (e.g., if you installed Xcode 3.1 and SDK 4.3 in their default locations) within:

/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app

Apps that are installed on your iPhone Simulator should be (if for example compiled for iOS 4.3) located in:

~/Library/Application Support/iPhone Simulator/4.3/Applications/[app GUID]

If you are looking for .sqlite database within Application, it should reside in:

~/Library/Application Support/iPhone Simulator/4.3/Applications/[app GUID]/Documents/[appname].sqlite 

Xcode 6

The simulator devices are located in:

~/Library/Developer/CoreSimulator/Devices/

so your application data (e.g. application database in app Document folder) will be in

~/Library/Developer/CoreSimulator/Devices/[simulator device id]/data/Applications/[app GUID]/Documents/[appname.sqlite]
Dave Jarvis
  • 28,853
  • 37
  • 164
  • 291
jki
  • 4,330
  • 1
  • 31
  • 28
  • Yes It is there. But how can I view the database file. – Arvind May 07 '11 at 08:47
  • If you want a free SQLite viewer, go here: http://itunes.apple.com/us/app/sqlvue-lite/id433341470?mt=12 – sudo rm -rf May 07 '11 at 21:06
  • 1
    There's a nice add-on for FireFox available: https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/ – runmad Sep 29 '11 at 02:28
  • We are now up to simulator 5.0 and 6 is in beta 4 stage. I would suggest testing with: ls -la ~/Library/Application\ Support/iPhone\ Simulator/*.*/Applications – Bruno Bronosky Aug 06 '12 at 21:31
  • was getting error `"tmp" could not be removed because you do not have permission` when trying to launch simulator, clearing out `~/Library/Developer/CoreSimulator/Devices/` and resetting the settings in the simulator fixed everything – andrew Sep 19 '14 at 14:31
15

On Mac OS X 10.7 the users/[username]/Library is hidden. Reveal it using:

chflags nohidden ~/Library
Dave Jarvis
  • 28,853
  • 37
  • 164
  • 291
evya
  • 3,153
  • 1
  • 20
  • 26
  • Run these 2 commands in Terminal to see this directory in the Finder: 1) defaults write com.apple.finder AppleShowAllFiles TRUE 2) killall Finder – James Toomey Nov 07 '14 at 19:34
9

In IOS5, follow this step

  1. Right Click finder in Dock.
  2. Click 'Go to Folder'.
  3. Give folder name as "/Users/'USER NAME'/Library/Application Support/iPhone Simulator/"

It will take you there.

ram
  • 925
  • 7
  • 8
Dhana
  • 99
  • 1
  • 1
5

NOTE: When you run the simulator, it creates a directory under your home directory located at:

~/Library/Application Support/iPhone Simulator/

When you install an application onto the simulator, it creates a sandbox for the application in a path that looks something like this:

~/Library/Application Support/iPhone Simulator/user/Applications/<GUID>

Where <GUID> is a directory with the name being a GUID assigned to the application during the installation process. The GUID isn’t particularly necessary to find for you application, and the path to your application’s sandbox can be found with a quick display of command-line foo. From the ~/Library/Application Support, run:

Deminem$ find ./ -name "AppName.app"

And, voila. It will return a list of all the sandbox directories which contains this application. The "private" data for your app inside the directory:

~/Library/Application Support/iPhone Simulator/user/Applications/<GUID>/Documents

Good luck! ;)

Deminem
  • 650
  • 5
  • 16
  • 2
    But here is not a directory named iphone simulator in Application Support. – Arvind May 07 '11 at 09:16
  • I mentioned run inside the `~/Library/Application Support`, so it will list down all the sandbox paths for your app. Or you can run it from users directory `/Users/Deminem` which will show you all the paths for this file. – Deminem May 07 '11 at 09:23
  • Do I need to reinstall iphone simulator – Arvind May 07 '11 at 09:40
  • Have you execute the above command? and if you can print the trace here so i can track the problem. – Deminem May 07 '11 at 09:46
  • 1
    Yes I have run find ./ iphone\ simulator, find: iphone simulator: No such file or directory – Arvind May 07 '11 at 12:17
  • Ah men! i told you run this command on terminal: `find ./ -name "YourAppName.app"`. But before running this make sure that you've created the app in the sandbox by run your project one time. – Deminem May 07 '11 at 14:04
  • This way we will know the exact location of your apps sandbox. Or may be helps to tackle down the actual issue. – Deminem May 07 '11 at 14:08
  • The actual solution I found on another Stack Overflow article. i had the same issue. The iPhone Simulator folder is hidden by default: type this in a terminal screen: chflags nohidden ~/Library/ – logixologist May 05 '13 at 06:37
2

Now on ios 8 the application data is located at Library/Developer/CoreSimulator/Devices/DEVICE NUMBER/data/Containers/Data/Application/APPLICATION ID

  • Note that APPLICATION ID above changes every run, but -[NSFileManager URLsForDirectory:inDomains:] and NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) will always use the current value. Your code should not depend on the full path to persist between runs of the application. – Logachu Oct 23 '14 at 18:47
2

On XCode 8. the sqlite file is in

~/Library/Developer/CoreSimulator/Devices/[DEVICE ID ]/data/Containers/Data/Application/B4813EE5-CC8E-4728-872E-41918AD1C14D/Documents/[APPLICATION NAME].sqlite

I don't know the mean by "B4813EE5-CC8E-4728-872E-41918AD1C14D".

The way to get DEVICE ID:

  1. Click to dropdown the simulators list

enter image description here

  1. Click "Add Additional Simulators..." enter image description here

  2. Select the simulator you are using

LCB
  • 822
  • 9
  • 18
1

We are now up to simulator 5.0 and iOS 6 is in beta 4 stage. All previous answers and comments are out of date.

I would suggest testing with

ls -la ~/Library/Application\ Support/iPhone\ Simulator/*.*/Applications

To answer the specific question about databases

find ~/Library/Application\ Support/iPhone\ Simulator/*.*/Applications -name \*.sqlite

That should last until Apple makes a drastic change.

Bruno Bronosky
  • 54,357
  • 9
  • 132
  • 120
0

You can find it here

/Users/YOURUSER/Library/Application Support/iPhone Simulator/5.1/Applications

or

/Users/YOURUSER/Library/Application Support/iPhone Simulator/6.0/Applications

Herman Schoenfeld
  • 7,500
  • 3
  • 33
  • 48
0

You can also write two lines of code that will tell you exactly where your app is located.

NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
NSLog(@"%@", appFolderPath);
AmirZ
  • 341
  • 3
  • 11
0

In iOS 10, Xcode 8.3.3,

Find the Document path from NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)

then you can find the sqlite file in path printed

snjmhj
  • 645
  • 7
  • 14
0

It sounds like you're talking about the SQLite file used by Core Data – if so, that file should be in ~Library/Application Support/iPhone Simulator/4.2/Applications/[AppID]/Library/ (assuming you're simulating iOS 4.2). If it's not there, I'm not sure where else it would be.

Scott Forbes
  • 7,347
  • 1
  • 24
  • 39