Can't locate default.realm when I sign the app

I’m almost 100% sure the root cause of this issue is not coming from Realm, but the resulting problem is affecting Realm, so I’ll post it here.

The thing is that I have an app with two versions.

  • Version 1. The app is unsigned. When I install it, it looks like the contents of the app are located at ~/Library/Containers/com.dgrcode.{appName}/Data/. Then, I can locate the default.realm file at the container path + (.../Data)/Library/Application Support/default.realm

  • Version 2. The app is signed with a “Personal Team” certificate manually with the command codesign -v --sign .... It looks like the contents of the app are located at ~/.
    I’m not sure why this happens (I’ve asked on StackOverflow and Apple Developer Forums, but no luck). But still, the problem is that I can’t locate default.realm inside ~/Library/Application Support/default.realm. It’s not there

The Mac search can’t find even one of them, so also not very helpful.

Now the weird part is that if I don’t sign version 2, it still uses ~/Library/Containers/com.dgrcode.{appName}/Data.

My two questions are:

  • Where could the default.realm be located when I use the signed version 2?
  • Have you ever seen a scenario where just signing the .app changes the location of the default realm ?

More info is needed.

When a new app is created in XCode, Automatically manage signing is checked by default.

Did you uncheck that?

Is App Sandboxing enabled or has it been removed? How is it configured?

As a test, I created a fresh project “RealmTest” and set it up use Cocoapods. (deleted sandboxing).

There’s one class PersonClass and a button that creats the PersonClass and writes it to the realm.default

The first attempt with with the project not signed. Ran the project, clicked the button to add a person to realm. The default realm was written here


I then turned on Automatically manage signing & sign to run locally. I ran the project again and clicked the button. The file at that same location was updated.

Lastly, I set it to use a Team and ran again. Same file, same location.

If you’re using sandboxing, then containers is where the data would go but in the above testing, the default.realm file location does not change with or without signing.

With sandboxing on, I did the exact same test and data with and without signing was written to



The question is also a cross post to a question on SO which has more details

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.