Alvin Varghese Alvin Varghese - 3 months ago 59
Swift Question

How to find Realm file location of a Mac App

First of all, I am very new to


I have tried this in

print("Realm Path : \(realm.configuration.fileURL?.absoluteURL)")

But it gave me error because, I have added some new properties to the
object, which produced conflicts with the old schema and crashed the app before even printing this.

If you are interested in the crash log. But it has nothing to do with the main question, right?

fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=10 "Migration is required due to the following
- Property 'id' has been added to latest object model." UserInfo={NSLocalizedDescription=Migration is required due to the
following errors:
- Property 'id' has been added to latest object model., Error Code=10}: file
line 54

I have one more doubt. I have added this, the realm has to
before even initialising the old objects right? But it just crashed with the log given above.

import Cocoa
import RealmSwift
import Realm

//MARK: Global Variables

public let realm = try! Realm()

func applicationDidFinishLaunching(aNotification: NSNotification) {
print("Realm Path : \(realm.configuration.fileURL?.absoluteURL)")

So now I want to delete the
file, but I have no idea where to find it. I have searched in Mac using extension
, but could not the find the expected file. I have the
Realm browser
app, I thought it would redirect me to the file location, but it didn't, it just opened the
folder, there is no realm file.

How would you do it? Thanks it advance.


The Realm does change when you create new file.

Just add the following line to your ViewDidLoad method:


This line will print the location to XCode console. Copy the file path, go to Finder -> Go -> Go go Folder... -> paste the path and hit Go.