How to open a core data database? How to open a core data database? database database

How to open a core data database?


You should be able to view the database directly using the sqlite3 command line tool. The database should be stored in the following directory:

~/Library/Application Support/iPhone Simulator/User/Applications/{your application GUID}/Documents/{your application name}.sqlite

To view the database, just type in the following in a terminal (note, sqlite3 should already be installed on your system by default):

sqlite3 {your application name}.sqlite

You can then run regular SQL to view the data in the database.

Note, the following useful commands:

  • .help - Shows sqlite specific commands and what they do
  • .tables - Shows all tables in the database
  • .schema {followed by table name} - Shows the create statement used to create the table
  • .quit - Exits sqlite3


It depends what format the data store is (Core Data currently supports XML, binary, and SQLite persistent data stores). XML data stores can be viewed using a text editor. Binary data stores can only be accessed via code. You can open a SQLite data store via the sqlite command line or via any number of GUI SQLite browsers. Keep in mind, however, that the on-disk representation (in a data base or otherwise) is an implementation detail of how Core Data chooses to persist an object graph to disk. Don't rely on this format in any way except to satisfy your curiosity. If you are trying to track down a bug, there are much better ways than poking in the data store.


~/Library/Application Support/iPhone Simulator/User/Applications/{APP GUID}/Documents/your_xcdatamodel.sqlite