Prerequisites
Software Requirements
- macOS 15.0 or higher
- Xcode Command Line Tools
- Homebrew package manager
Install Basic Tools
- Install Xcode Command Line Tools:
- Install Homebrew (if not already installed):
- 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
- Check and configure environment variables
- Validate third-party dependencies (protobuf, thrift, brpc, etc.)
- Generate script-based sources and let CMake materialize BE Thrift/Protobuf outputs
- Compile BE code
- 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, editoutput/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, editoutput/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: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:
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:- Do Not Affect Linux Compilation: All modifications are isolated through conditional compilation
- Minimize Code Changes: Prefer disabling features through configuration
- Centralized Management: Build entrypoints remain at the repository root, macOS build helpers live in
build-support/, and Darwin third-party logic lives inthirdparty/ - Use Standard Tools: Rely on Homebrew and LLVM toolchain
- 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 usingthirdparty/installed/bin/protoc (version 3.16.1) instead of system or Homebrew’s protobuf:
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:- Check the relevant root build scripts, macOS helpers in
build-support/, and Darwin third-party scripts inthirdparty/ - Follow the principle of “do not affect Linux compilation”
- Use
#ifdef __APPLE__for platform-specific code modifications - Submit a Pull Request with detailed description of changes
- Support compiling more disabled features on Mac
- Continuously improve the @mac tag for SQL tests
Happy coding on macOS!