NitroSQLite

macOS

Installation, database storage, and Apple build options.

React Native macOS has no Swift Package Manager build of React Native yet, so Nitro SQLite builds through CocoaPods on macOS. Use React Native macOS 0.83 or later with Hermes. It requires macOS 14 and the same Xcode as iOS.

CocoaPods support for Nitro V1 is not published yet. It needs a Nitro release with CocoaPods support and support for older JSI versions, because React Native macOS 0.83 ships the JSI of React Native 0.83. Until then, use Nitro SQLite 10.x with Nitro Modules 0.37.2 on macOS, as described in the 10.4.0 macOS guide.

Install the packages, then load Nitro's CocoaPods helper in the Podfile and call its hooks:

macos/Podfile
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve("react-native-nitro-modules/cocoapods.rb", { paths: [process.argv[1]] })', __dir__]).strip

target 'MyApp-macOS' do
  use_native_modules!
  use_nitro_modules!

  # use_react_native!(...)

  post_install do |installer|
    react_native_post_install(installer)
    nitro_post_install(installer)
  end
end

Then install Pods and rebuild:

cd macos && pod install

Databases use an app-specific Application Support directory. See file locations for the location option. Sandboxed apps can access only their permitted containers.

Apple build options

The RNNitroSQLite pod reads the shared Configuration settings from package.json when you install Pods. It also accepts the environment overrides NITRO_SQLITE_THREADSAFE and NITRO_SQLITE_PERFORMANCE_MODE. To link Apple's system SQLite instead of the bundled copy, run NITRO_SQLITE_USE_PHONE_VERSION=1 pod install.

For vector search, install react-native-nitro-sqlite-vec and run NITRO_SQLITE_VEC=1 pod install from macos. Rebuild and follow the vector search guide.

Run the example

The repository's example/macos app requires macOS 14 or later. Install the workspace and Ruby dependencies, then run the pods:macos and macos scripts from example. To run Metro separately, use the start script and pass --no-packager to macos. For a release build, pass --mode Release --no-packager. Until Nitro publishes its CocoaPods support, the example applies it through the patches in the repository's patches directory.

On this page