Skip to main content
This document provides detailed instructions on how to compile, run, debug, and test StarRocks on the macOS ARM64 platform (Apple Silicon), making it easier for developers to work on Mac.

Prerequisites

Software Requirements

  • macOS 15.0 or higher
  • Xcode Command Line Tools
  • Homebrew package manager

Install Basic Tools

  1. Install Xcode Command Line Tools:
  1. Install Homebrew (if not already installed):
  1. No separate macOS environment script is required. The third-party build step below installs the required Homebrew formulas.

Mac Compilation

Compile Third-party Libraries

Before compiling BE on macOS, compile third-party dependencies from the repository root:

Compile FE

Compilation Steps

Compilation Output

After compilation, FE artifacts are located in:

Compile BE

Use the root build script to compile BE on macOS.

First-time Compilation

The first-time compilation will automatically complete the following steps:
  1. Check and configure environment variables
  2. Validate third-party dependencies (protobuf, thrift, brpc, etc.)
  3. Generate script-based sources and let CMake materialize BE Thrift/Protobuf outputs
  4. Compile BE code
  5. Install to output/be/ directory

Compilation Output

After compilation, BE artifacts are located in:

Configure and Run FE

Configure FE

For local single-node development, edit output/fe/conf/fe.conf and set required defaults such as priority_networks, default_replication_num, and bdbje_reset_election_group.

Start FE

View FE Logs

Configure and Run BE

Configure BE

For local single-node development, edit output/be/conf/be.conf and set required defaults such as priority_networks, datacache_enable, enable_system_metrics, and sys_log_verbose_modules.

Start BE

View BE Logs

Stop BE

Add BE to Cluster

After starting BE, you need to register it to FE via MySQL client:
Confirm that the Alive field is true, indicating BE is running properly.

Connect and Test

Connect Using MySQL Client

Basic Testing

Debug BE

Using LLDB for Debugging

macOS uses LLDB as the debugger (replacement for GDB).

Attach to Running BE Process

Common LLDB Commands

Export All Thread Stacks to File

SQL Testing

StarRocks provides a complete SQL testing framework that can run on macOS.

Prepare Test Environment

Mark macOS Compatible Test Cases

Since the macOS version has some features disabled, you need to mark which test cases can run on Mac:

Run SQL Tests

Test Configuration

The test framework will automatically connect to the local StarRocks instance:
  • Host: 127.0.0.1
  • Port: 9030
  • User: root
  • Password: empty

Development Tools Configuration

Git Pre-commit Hook (Code Formatting)

To maintain consistent code style, it’s recommended to configure a pre-commit hook to automatically format C++ code. Create the file .git/hooks/pre-commit:
Add execute permissions:

Limitations and Known Issues

Features Disabled in macOS Version

Due to platform compatibility limitations, the following features are disabled in the macOS version:

Storage and Data Sources

  • HDFS Support: No HDFS client library available
  • ORC Format: Complete ORC module disabled
  • Avro Format: avro-c library compatibility issues
  • JDBC Data Source: JNI/Java dependencies
  • MySQL Scanner: Missing MariaDB development headers

Cloud Service Integration

  • AWS S3: Poco HTTP client compatibility issues
  • Azure Storage: Azure SDK compatibility issues
  • Apache Pulsar: librdkafka++ compatibility issues

Performance and Monitoring Tools

  • Google Breakpad: Crash reporting (minidump)
  • OpenTelemetry: Distributed tracing

Other Features

  • GEO Module: Missing generated parser files
  • JIT Compilation: Requires complete LLVM development environment
  • Starcache: Cache acceleration feature
  • CLucene: Inverted index functionality
  • LZO Compression: Use alternative compression algorithms

Design Principles

The macOS compilation implementation follows these principles:
  1. Do Not Affect Linux Compilation: All modifications are isolated through conditional compilation
  2. Minimize Code Changes: Prefer disabling features through configuration
  3. Centralized Management: Build entrypoints remain at the repository root, macOS build helpers live in build-support/, and Darwin third-party logic lives in thirdparty/
  4. Use Standard Tools: Rely on Homebrew and LLVM toolchain
  5. Compile Key Dependencies from Source: Ensure ABI compatibility (protobuf, thrift, brpc)

FAQ

Q: Getting “protobuf version mismatch” error during compilation A: Make sure the BE CMake build is using thirdparty/installed/bin/protoc (version 3.16.1) instead of system or Homebrew’s protobuf:
Q: Out of memory during compilation A: Reduce the number of parallel compilation tasks:
Q: FE cannot connect to BE A: Ensure that the priority_networks configuration in FE and BE is consistent and includes your local IP address. Q: Some test cases fail A: Check if they are tests related to disabled features (such as HDFS, S3, ORC, etc.), as these tests cannot pass on macOS.

Contribution Guidelines

If you find issues or have improvement suggestions on macOS:
  1. Check the relevant root build scripts, macOS helpers in build-support/, and Darwin third-party scripts in thirdparty/
  2. Follow the principle of “do not affect Linux compilation”
  3. Use #ifdef __APPLE__ for platform-specific code modifications
  4. Submit a Pull Request with detailed description of changes
Contributions are welcome in the following areas:
  • Support compiling more disabled features on Mac
  • Continuously improve the @mac tag for SQL tests

Happy coding on macOS!