Compile on MacOS
This guide is about how to compile Doris on MacOS.
tip
Currently, this is not supported in the compute-storage decoupled mode.
Prerequisites
- MacOS 12 (Monterey) or later (Both Intel and Apple Silicon are supported.)
- Homebrew
Compile source code
- Install dependencies using Homebrew
1. brew install automake autoconf libtool pkg-config texinfo coreutils gnu-getopt \
2. python@3 cmake ninja ccache bison byacc gettext wget pcre maven llvm@16 openjdk@11 npm
tip
On MacOS, since Homebrew does not provide an installation package for JDK8, JDK11 is used here instead. Alternatively, you can manually download and install JDK8.
- Compile source code
1. bash build.sh
tip
The first step of compiling Doris is to download and compile third-party libraries. You can download the pre-compiled versions of third-party libraries provided by the Doris community. Please refer to the instructions below for downloading pre-compiled third-party libraries to speed up the build process.
Start
- Increase file descriptors limit
1. # Increase the file descriptor limit using the ulimit command.
2. ulimit -n 65536
4. # Check if the change is effective.
5. $ ulimit -n
7. # Add the configuration to your startup script so that you do not have to set it again every time you open a new terminal session.
8. # If you are using bash, execute the following statement:
9. echo 'ulimit -n 65536' >>~/.bashrc
10. # If you are using zsh, execute the following statement:
11. echo 'ulimit -n 65536' >>~/.zshrc
- Start BE
1. cd output/be/bin
2. ./start_be.sh --daemon
- Start FE
1. cd output/fe/bin
2. ./start_fe.sh --daemon
Speed up by using pre-compiled third-party libraries
Download the pre-compiled third-party libraries from Apache Doris Third Party Prebuilt. Refer to the command below:
1. cd thirdparty
2. rm -rf installed
4. # Intel chip
5. curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-darwin-x86_64.tar.xz \
6. -o - | tar -Jxf -
8. # Apple Silicon chip
9. curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-darwin-arm64.tar.xz \
10. -o - | tar -Jxf -
12. # Check if protoc and thrift functions normally
13. cd installed/bin
15. ./protoc --version
16. ./thrift --version
tip
When running protoc and thrift, you may encounter an issue where the binary cannot be opened due to developer verification. To resolve this, you can go to “Security & Privacy” settings. In the “General” tab, click on the “Open Anyway” button to confirm your intent to open the binary. Refer to: <https://support.apple.com/en-us/102445>
Common Errors
- When running
protocandthrift, you may encounter an issue where the binary cannot be opened due to developer verification. To resolve this, you can go to “Security & Privacy” settings. In the “General” tab, click on the “Open Anyway” button to confirm your intent to open the binary. Refer to: <https://support.apple.com/en-us/102445>. - When compiling with a Mac with an M3 chip, the compilation of the proto file fails. The failure log is as follows:
1. [ERROR] ... [0:0]: --grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.
The reason for this error may be that the Apple arm-based chip does not support software on the x86 platform. You can download the protoc-gen-grpc-java software used from <https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/>, and the version information can be viewed from the grpc.java.artifact property under the protoc_rosetta profile in fe/fe-core/pom.xml. If the following error is reported after downloading and executing, it means that the current Mac cannot execute software based on x86 compiled software.
1. zsh: bad CPU type in executable:./protoc-gen-grpc-java-1.34.0-osx-x86_64.exe
You can refer to the official documentation <https://support.apple.com/en-us/102527> and install Rosetta to solve this problem.
