Skip to main content
RocksDB provides full support for macOS with optimized builds through Homebrew or manual compilation from source.

Prerequisites

System Requirements

  • macOS Version: OS X 10.9 (Mavericks) or later
  • Xcode Command Line Tools: Required for compilation
  • C++20 Support: Available in recent Xcode versions

Developer Tools

Install Xcode Command Line Tools:

Installation Methods

The simplest way to install RocksDB on macOS:
1

Install Homebrew

If you haven’t installed Homebrew yet:
2

Install Xcode Command Line Tools

Even when using Homebrew, you need the command line tools:
3

Install RocksDB

This installs RocksDB along with all required dependencies including compression libraries.
4

Verify installation

Option 2: Building from Source

For custom builds or development work:
1

Install dependencies

Install required compression libraries:
2

Clone repository

3

Build RocksDB

Don’t use make or make all for production builds. These compile in debug mode, which is significantly slower than release mode.
4

Run tests (optional)

Compiler Requirements

RocksDB requires C++20 support:
  • Clang: Version 10 or higher (included in recent Xcode)
  • GCC: Version 11 or higher (can be installed via Homebrew)

Using GCC instead of Clang

If you prefer GCC over Clang:

Build Options

Portable Build

By default, RocksDB optimizes for your specific Mac’s CPU. To build a binary compatible with different Macs:

Universal Binary (Intel + Apple Silicon)

To build a universal binary that runs on both Intel and Apple Silicon Macs:
Universal binary builds require Xcode 12 or later and may not support all optimization flags.

Apple Silicon (M1/M2/M3) Support

RocksDB fully supports Apple Silicon processors:

Native ARM64 Build

Rosetta 2 (Intel Emulation)

Native ARM64 builds provide better performance on Apple Silicon. Only use Rosetta 2 for compatibility with existing Intel-only dependencies.

Development Setup

Installing Additional Tools

For RocksDB development on macOS:

Xcode Project Generation

Generate an Xcode project for IDE development:
Open the generated .xcodeproj file in Xcode.

Configuration for macOS

Compression Libraries

RocksDB links with the following compression libraries on macOS:
  • zlib: Included with macOS
  • snappy: Install via Homebrew
  • lz4: Install via Homebrew
  • zstandard: Install via Homebrew
  • bzip2: Included with macOS
Verify installed compression libraries:

Environment Variables

For custom library paths:

Performance Optimization

For production builds on macOS:

Thread Pool Configuration

macOS uses Grand Central Dispatch (GCD), but RocksDB uses std::thread for consistency:

Troubleshooting

Ensure Xcode Command Line Tools are installed:
If already installed, reset the path:
Install missing libraries via Homebrew:
Ensure Homebrew’s library path is in your environment:
Update Xcode to the latest version:
Ensure you’re building for the correct architecture:

Verification

Verify your RocksDB installation:

Next Steps

Getting Started

Learn the basics of using RocksDB

API Reference

Explore the complete API documentation

Configuration

Optimize RocksDB for your workload

Performance

Benchmark and tune performance