Swift macOS CLI Tool Error


I’ve been looking for an answer to this for days and I can’t seem to find anything.

I’m creating a tool to import data from our API and create a realm file, I’m writing this in swift as a CLI tool to run on a Mac mini at regular intervals. I have it where it will download the data and decode it into my class objects without any issues. But when I try and run

let realm = try! Realm()

The application crashes with the following error:

Terminating app due to uncaught exception ‘RLMException’, reason: ‘The RealmSwiftPermission.role property must be marked as being optional.’

I’m not sure what permission I need to add, where I need to add it, or how to just set it as optional? I don’t have anything in my stuff that is named RealmSwiftPermission.role and when I look through the RealmSwift-Swift.h framework file I find the RealmSwiftPermissionRole class with the Swift_CLASS_Named(“Permission”), but not sure if this is the same thing?

I’ve gone through a ton of different posts about permissions and trying to figure this out, but I don’t know what I’m missing. Any help would be appreciated. Thanks!!