Failed to load dynamic library 'realm_dart': dlopen(realm_dart, 0x0001)

When I start using Sync I always receive the following Exceptions displayed below. These exceptions only occur when using visual studio code. No exceptions seem to occur when running directly from the command line or from within Xcode. Despite this warning, everything seems to work fine. Any help to avoid this problem is appreciated.

Flutter doctor -v does not display any problems.

Realm version: ^0.11.0+rc
Flutter version: 3.7.0

Exception has occurred.
ArgumentError (Invalid argument(s): Failed to load dynamic library 'realm_dart': dlopen(realm_dart, 0x0001): tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRootrealm_dart' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/realm_dart' (errno=2), '/usr/lib/swift/realm_dart' (errno=2, not in dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/realm_dart' (errno=2), '/usr/lib/swift/realm_dart' (errno=2, not in dyld cache), '/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/Frameworks/realm_dart' (errno=2), '/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/Frameworks/realm_dart' (errno=2), '/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/Frameworks/realm_dart' (errno=2), '/usr/lib/realm_dart' (errno=2, not in dyld cache), 'realm_dart' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/realm_dart' (errno=2))


Exception has occurred.
ArgumentError (Invalid argument(s): Failed to load dynamic library '/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/realm_dart': dlopen(/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/realm_dart, 0x0001): tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/realm_dart' (errno=2), '/Users/taco/Library/Developer/CoreSimulator/Devices/777429D3-82C2-4EEE-B4B1-E3822E51B9FA/data/Containers/Bundle/Application/69CD69C9-C345-439F-A1BD-2A7815A6EC4E/Runner.app/realm_dart' (errno=2))
1 Like

Hi @Taco_Kind,
Which package do you use ‘realm_dart’ or ‘realm’?
If it is realm_dart, you have to make sure that you have run ‘dart run realm_dart install’.

@Taco_Kind,
if you are trying to run the tests from Visual studio code you have to run flutter pub run realm install first.

I’ve got the exact same problem. Running from the terminal works fine. Manually skipping the errors works too. I’ve using the ‘realm’ package. I did try switching everything over to ‘realm_dart’ and got the same problem again. I didn’t have this issue always. I can’t really think of anything I changed in my project that would have caused this error to start popping up.

I’ve figured that the error occurs specifically when creating a configuration object.

I think this issue might have something to do with the init.dart file from the realm package. Check out this comment on a github issue I created it might help! GitHub Issue

1 Like

a somewhat rigorous solution for me was to regenerate the iOS files. It also seems that changes were made with 0.10rc that fixes it after the regeneration. Also, with creating a new project the problem does not occur anymore. What exactly causes the problem remains unknown to me…

1 Like

Hi all,
Thanks for reporting!
I answered to the relevant issue in GitHub Error: Failed to load dynamic library 'realm_dart' on ios · Issue #1157 · realm/realm-dart · GitHub
You can follow the link.