Install Realm for iOS, macOS, tvOS, and watchOS

MongoDB Realm's Swift SDK enables your iOS, macOS, tvOS, and watchOS applications to interact with MongoDB Realm using either the Swift or Objective-C programming languages. This page details how to install Realm in your project and get started.

Before getting started, ensure your development environment meets the following prerequisites:

  • Xcode version 10.0 or higher.
  • Target of iOS 8.0 or higher, macOS 10.9 or higher, tvOS 9.0 or higher, or watchOS 2.0 or higher.

There are special considerations when using Realm Database with tvOS. See Build for tvOS for more information.

You can use SwiftPM, CocoaPods, or Carthage to add the MongoDB Realm Swift SDK to your project.


In Xcode, select File > Swift Packages > Add Package Dependency.


Copy and paste the following into the search/input box, then click Next.

Leave the default value of Up to Next Major, then click Next.


Select both Realm and RealmSwift, then click Finish.

Add the following line at the top of your source files to use MongoDB Realm:

import RealmSwift

If you have build issues after using one of these methods to install Realm, see our troubleshooting guidelines for information about resolving those issues realm.

Give Feedback