If you’re running your app in one of Xcode’s simulators, then the Realm files are stored in your Mac’s file system. They’re typically somewhere along the lines of
While my app’s in development, I’ll normally print the location of a Realm’s file whenever I open it. Don’t worry if you’re not explicitly opening your Realm(s) in your code (e.g., if you’re using the default realm) as I’ll cover the file search approach soon. This is the code to add to your app once you’ve opened your realm –
print("User Realm User file location: \\(realm.configuration.fileURL!.path)")
If you don’t want to edit the code, then an Xcode breakpoint delivers the same result:
Once you have the file location, open it in Realm Studio from the terminal:
Less scientific but simpler is to take advantage of the fact that the data files will always be of type
realm and located somewhere under
~/Library/Developer/CoreSimulator/Devices. Open Finder in that folder:
open ~/Library/Developer/CoreSimulator/Devices and then create a “saved search” so that you can always find all of your realm files. You’ll most often be looking for the most recent one.
The nice thing about this approach is that you only need to create the search once. Then click on “Realms,” find the file you need, and then double-click it to open it in Realm Studio.