How to Find Realm File
Copy the database from the emulator/phone to view it. That can be done by using ADB:
adb pull /data/data/<packagename>/files/ .
That command will pull all Realm files created by
Realm.getInstance(new RealmConfiguration.Builder(context).build()) . The default database fileis called
Note that this will only work on an emulator or rooted device.
If your App is on Device
Make sure your device is connected and go to the devices window in the Xcode menu Window > Devices (⌘⇧2). Then choose your device and your app from a list of installed apps with debugging permissions.
After selecting your app, go to the cog at the bottom of the table view and select “Download Container…“. From there you will be able to pull the file from the documents location to your Mac. It will be saved as an xcappdata bundle.
When you open the local path in Finder, where you saved it, you can tap into that by selecting “Show Package Contents” in the context menu of the finder, when you select the file. A new finder window will open, where you find your Realm inside in the following path (e.g.):
AppData/Documents/default.realm (The path is
/private/var/mobile, which is used by iOS on the device filesystem.
If your App is on the Simulator
Go to your user’s directory:
The easiest way to get the current path of the default realm is to pause the simulator and enter the following into the LLDB console:
(lldb) po [RLMRealmConfiguration defaultConfiguration].fileURL
Swift using Realm Objective-C:
(lldb) po RLMRealmConfiguration.defaultConfiguration().fileURL
Swift using Realm Swift:
(lldb) po Realm.Configuration.defaultConfiguration.fileURL
Or if you have an
RLMRealm instance at hand, you can use:
(lldb) po myRealm.configuration.fileURL
Then just copy this path, open your terminal, and type
open [Pasted path here]
NOTE: Some paths have a space in them so be sure to use “\” before the space to escape it
Printing File Location
Print file location using:
Add the following line to
Implement Realm at the start of your class
Then to print the location to the console :
Console.WriteLine( RealmConfiguration.PathToRealm() );
Or if you’re using DefaultConfiguration, you can use :
Console.WriteLine( RealmConfiguration.DefaultConfiguration.DatabasePath );
How to reach the file :
IOS simulator :
To copy the file path, go to Finder → Go → Go to Folder… (or ⌘+⇧+G)→ paste the path and hit Go.
Android emulator :
Open Android device Monitor (on visual studio → tools menu → Android → Android device Monitor ) (on Xamarin studio → Tools menu → Open Android device Monitor ) → File Explorer tab → follow the file path
The fastest way to find the file of an app in the simulator is SimPholders. This will allow you to access your app’s documents directory directly from your menu bar.
Note if SimPholders has taken them to the wrong simulator app folder, print out your realm path by following the steps above.