Skip to main content
GRDB.swift can be installed using Swift Package Manager, CocoaPods, or manually. The standard installation uses the version of SQLite that ships with your target operating system.
For encryption support with SQLCipher, see the Encryption guide. For custom SQLite builds, refer to the Custom SQLite Builds documentation.

Requirements

Before installing GRDB, make sure your project meets these requirements:
  • iOS 13.0+
  • macOS 10.15+
  • tvOS 13.0+
  • watchOS 7.0+
  • SQLite 3.20.0+
  • Swift 6.1+ / Xcode 16.3+

Swift Package Manager

The Swift Package Manager is the recommended way to install GRDB. It automates the distribution of Swift code and integrates seamlessly with Xcode.
1

Add Package Dependency

In Xcode, select File → Add Package Dependencies…Enter the GRDB repository URL:
https://github.com/groue/GRDB.swift.git
2

Choose Library

GRDB offers two libraries:
  • GRDB (recommended) - Standard static library
  • GRDB-dynamic - Dynamic framework
Choose GRDB unless you specifically need to link a shared dynamic framework across multiple targets. See How to link a Swift Package as dynamic for more information.
3

Add to Package.swift (Optional)

If you’re building a Swift package, add GRDB to your Package.swift dependencies:
Package.swift
let package = Package(
    name: "YourPackage",
    dependencies: [
        .package(url: "https://github.com/groue/GRDB.swift.git", from: "7.10.0")
    ],
    targets: [
        .target(
            name: "YourTarget",
            dependencies: [
                .product(name: "GRDB", package: "GRDB.swift")
            ]
        )
    ]
)
Linux Support: Linux support is provided by contributors and is not automatically tested or officially maintained. If you encounter build or runtime issues on Linux, please open a pull request with the necessary fix.

CocoaPods

CocoaPods is a dependency manager for Xcode projects. To use GRDB with CocoaPods (version 1.2 or higher), add it to your Podfile:
Podfile
pod 'GRDB.swift'
Then run:
pod install
Important CocoaPods Issue: Due to a CocoaPods issue, new versions of GRDB cannot be published to CocoaPods. The last version available is 6.24.1.To install later versions, use one of these workarounds:

Option 1: Use the GRDB7 Branch

This is equivalent to pod 'GRDB.swift', '~> 7.0' and tracks the latest GRDB 7.x version:
Podfile
# Tracks GRDB 7.x releases
pod 'GRDB.swift', git: 'https://github.com/groue/GRDB.swift.git', branch: 'GRDB7'

Option 2: Specify a Tagged Version

Pin to a specific version explicitly:
Podfile
# Replace with your desired version
pod 'GRDB.swift', git: 'https://github.com/groue/GRDB.swift.git', tag: 'v7.10.0'
GRDB can be installed as either a framework or a static library through CocoaPods.

Manual Installation

If you prefer not to use a dependency manager, you can integrate GRDB manually:
1

Download GRDB

Download the latest release or clone the repository:
git clone https://github.com/groue/GRDB.swift.git
cd GRDB.swift
git checkout v7.10.0  # Use the latest tagged version
2

Embed the Xcode Project

Drag and drop the GRDB.xcodeproj file into your own Xcode project.
3

Add Target Dependency

In your application target’s settings:
  1. Go to the Build Phases tab
  2. In the Target Dependencies section, add the GRDB target
For watchOS, add the dependency to your extension target instead.
4

Embed the Framework

In your application target’s settings:
  1. Go to the General tab
  2. In the Frameworks, Libraries, and Embedded Content section, add GRDB.framework
For watchOS, add the framework to your extension target instead.

Carthage

Carthage is not supported. For context about this decision, see issue #433.

Verify Installation

After installing GRDB, verify it works by importing it in your Swift code:
import GRDB

// Test that GRDB is available
let dbQueue = try DatabaseQueue()
print("GRDB installed successfully!")
If the import succeeds without errors, you’re ready to start using GRDB!

Next Steps

Now that GRDB is installed, check out the Quickstart guide to create your first database.

Build docs developers (and LLMs) love