Compilation on MacOS

This topic is about how to compile Doris from source with macOS (both x86_64 and arm64).

Environment Requirements

  1. macOS 12 (Monterey) or newer(both Intel chip and Apple Silicon chips are supported
  2. Homebrew

Steps

  1. Use Homebrew to install dependencies.

    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

Compilation on MacOS - 图1tip

The version of jdk installed using brew is 11, because on macOS, the arm64 version of brew does not have version 8 of jdk by default

  1. Compile from source.

    1. bash build.sh

Third-Party Libraries

  1. The Apache Doris Third Party Prebuilt page contains the source code of all third-party libraries. You can download doris-thirdparty-source.tgz to obtain them.

  2. You can download the precompiled third party library from the Apache Doris Third Party Prebuilt page. You may refer to the following commands:

    1. cd thirdparty
    2. rm -rf installed
    3. # Intel chips
    4. curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-darwin-x86_64.tar.xz \
    5. -o - | tar -Jxf -
    6. # Apple Silicon chips
    7. curl -L https://github.com/apache/doris-thirdparty/releases/download/automation/doris-thirdparty-prebuilt-darwin-arm64.tar.xz \
    8. -o - | tar -Jxf -
    9. # Make sure that protoc and thrift can run successfully.
    10. cd installed/bin
    11. ./protoc --version
    12. ./thrift --version
  3. When running protoc or thrift, you may meet an error which says the app can not be opened because the developer cannot be verified. Go to Security & Privacy. Click the Open Anyway button in the General pane to confirm your intent to open the app. See https://support.apple.com/en-us/HT202491.

Start-up

  1. Set file descriptorsNOTICE: If you have closed the current session, you need to set this variable again)。

    1. ulimit -n 65536

    You can also write this configuration into the initialization files so you don’t need to set the variables again when opening a new terminal session.

    1. # bash
    2. echo 'ulimit -n 65536' >>~/.bashrc
    3. # zsh
    4. echo 'ulimit -n 65536' >>~/.zshrc

    Check if the configuration works by executing the following command.

    1. $ ulimit -n
    2. 65536
  2. Start BE up

    1. cd output/be/bin
    2. ./start_be.sh --daemon
  3. Start FE up

    1. cd output/fe/bin
    2. ./start_fe.sh --daemon

FAQ

  1. Fail to start BE up. The log shows: fail to open StorageEngine, res=file descriptors limit is too small

    To fix this, please refer to the “Start-up” section above and reset file descriptors.

  2. Java Version

    The version of jdk installed with brew is 11, because on macOS, the arm64 version of brew does not have version 8 of jdk by default, and you can also download the jdk installation package for installation