How to find my realm file?
Finding a Realm File
For Android
How to view my Realm file in the Realm Browser?
For iOS
If your App is on Device
Make sure that your device is connected and go to the devices window in the Xcode menu Window > Devices (⌘⇧2). There you will be able to choose your device and your app from a list of installed apps with debugging permissions.
After selecting your app, go to the cog in the toolbar at the bottom of the table view and select “Download Container…“. 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 directory '/private/var/mobile' is the path, which is used by iOS on the device filesystem.
If your App is on the Simulator
Go to your user’s directory:
/Users/<username>/Library/Developer/CoreSimulator/Devices/<simulator-uuid>/data/Containers/Data/Application/<application-uuid>/Documents/default.realm
Probably 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:
Objective-C:(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
Helper Tool SimPholders
This is probably the fastest way to find the file of an app in the simulator. Install SimPholders. This will allow you to access your app’s documents directory directly from your menu bar.
Note Some people have mentioned that SimPholders has taken them to the wrong simulator app folder, if that's the case for you, print out your realm path by following the steps above, printing out your realm.path
How do I view my Realm file in the Realm Browser?
Currently the Realm Browser doesn't support accessing databases directly on the device, so you need to 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 using Realm.getInstance(new RealmConfiguration.Builder().build())
. The default database is called default.realm
.
Note that this will only work on a emulator or if the device is rooted.
Find path for Realm file with Realm React Native to use with Realm Browser
Just found the answer myself by digging through the docs:
console.log('create db:', db.path)
How can I get my Realm Database in a file to open in Realm Studio?
You can find your realm file in the Device File Explorer tab at the bottom right of Android Studio. The location will be /data/data/com.<package-name>/files/default.realm
assuming you haven't named your realm file. Simply right-click and "Save As" to a location on your PC and open in Realm Studio. You can't view the realm file on the actual device so you will have to download this realm file every time you want to inspect what's happening in realm. This also means that you need to download the realm file every time you make a change in realm that you want to inspect as you're not actually opening the realm file on the device.
Related Topics
Onclicklistener Not Responding
How to Troubleshoot "Inconsistency Detected: Dl-Lookup.C: 111" (Java Result 127) Error
Does Python Have an Equivalent to Java Class.Forname()
Java Embedded Databases Comparison
How to Execute a Java .Class from the Command Line
How to Convert Int[] to Integer[] in Java
Can a Java Class Add a Method to Itself at Runtime
Where Does Java's String Constant Pool Live, the Heap or the Stack
What Is the Default Access Specifier in Java
How to Check If Current Thread Is Not Main Thread
How to View Visual Gc in Visualvm
How to Convert a JSON String to a Map<String, String> with Jackson JSON
Good Way to Encapsulate Integer.Parseint()
Is There a Java API That Can Create Rich Word Documents
Java Stack Overflow Error - How to Increase the Stack Size in Eclipse